he2802 2 lat temu
rodzic
commit
d92c771abc
100 zmienionych plików z 5295 dodań i 347 usunięć
  1. BIN
      zhongzheng-admin-data/.mvn/wrapper/maven-wrapper.jar
  2. 2 0
      zhongzheng-admin-data/.mvn/wrapper/maven-wrapper.properties
  3. 1 1
      zhongzheng-admin-data/src/main/java/com/zhongzheng/controller/common/UserStudyLogController.java
  4. 67 5
      zhongzheng-admin-data/src/main/resources/application-dev.yml
  5. 88 27
      zhongzheng-admin-data/src/main/resources/application-prod.yml
  6. BIN
      zhongzheng-admin-data/src/main/resources/config/1342013901/apiclient_cert.p12
  7. BIN
      zhongzheng-admin-data/src/main/resources/config/1637492608/apiclient_cert.p12
  8. BIN
      zhongzheng-admin-data/src/main/resources/config/1640084970/apiclient_cert.p12
  9. 7 0
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/CommonController.java
  10. 67 4
      zhongzheng-admin/src/main/resources/application-dev.yml
  11. 62 0
      zhongzheng-admin/src/main/resources/application-prod.yml
  12. BIN
      zhongzheng-admin/src/main/resources/zhiyuan1689758857592/【建筑】2023年二建黄金卷(二)(1).docx
  13. BIN
      zhongzheng-admin/src/main/resources/zhiyuan1690785560230/法规——黄金卷.zip
  14. 16 6
      zhongzheng-common/pom.xml
  15. 1 1
      zhongzheng-common/src/main/java/com/zhongzheng/common/core/domain/entity/SysDictData.java
  16. 1 1
      zhongzheng-common/src/main/java/com/zhongzheng/common/core/domain/entity/TopSysRole.java
  17. 2 2
      zhongzheng-common/src/main/java/com/zhongzheng/common/core/domain/entity/TopSysUser.java
  18. 109 0
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/DateUtils.java
  19. 46 0
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/JavaMailUtils.java
  20. 3 2
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/ServletUtils.java
  21. 54 0
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/TelPhoneUtils.java
  22. 233 4
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/ToolsUtils.java
  23. 138 0
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/bank/DCCryptor.java
  24. 169 0
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/bank/DCHelper.java
  25. 61 0
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/bank/GENKey.java
  26. 271 6
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/file/FileUtils.java
  27. 20 0
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/file/ImageUtils.java
  28. 107 31
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/http/HttpUtils.java
  29. 319 1
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/poi/ExcelUtil.java
  30. BIN
      zhongzheng-common/src/main/resources/static/001.png
  31. BIN
      zhongzheng-common/src/main/resources/static/002.jpg
  32. BIN
      zhongzheng-common/src/main/resources/static/0020.jpg
  33. BIN
      zhongzheng-common/src/main/resources/static/0024.jpg
  34. BIN
      zhongzheng-common/src/main/resources/static/003.jpg
  35. BIN
      zhongzheng-common/src/main/resources/static/0030.jpg
  36. BIN
      zhongzheng-common/src/main/resources/static/00312.jpg
  37. BIN
      zhongzheng-common/src/main/resources/static/0033.jpg
  38. BIN
      zhongzheng-common/src/main/resources/static/004.jpg
  39. BIN
      zhongzheng-common/src/main/resources/static/005.jpg
  40. BIN
      zhongzheng-common/src/main/resources/static/0051.jpg
  41. BIN
      zhongzheng-common/src/main/resources/static/006.jpg
  42. BIN
      zhongzheng-common/src/main/resources/static/2323.jpg
  43. 8 2
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/aspectj/LogAspect.java
  44. 1 0
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/config/MybatisPlusConfig.java
  45. 18 5
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/config/SecurityConfig.java
  46. 4 4
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/mybatisplus/CreateAndUpdateMetaObjectHandler.java
  47. 2 2
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/mybatisplus/CustomTenantLineHandler.java
  48. 82 0
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/mybatisplus/CustomTenantLineInnerInterceptor.java
  49. 120 0
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/mybatisplus/FindInSetExpression.java
  50. 11 4
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/security/filter/JwtAuthenticationTokenFilter.java
  51. 2 3
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/DistributionSellerServiceImpl.java
  52. 1 1
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/SysLoginService.java
  53. 116 8
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/SysTenantServiceImpl.java
  54. 2 2
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/TokenService.java
  55. 137 0
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserLoginKeyServiceImpl.java
  56. 651 15
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java
  57. 146 1
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/WxLoginService.java
  58. 23 14
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/WxTokenService.java
  59. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/bo/ActivityRecommendQueryBo.java
  60. 2 3
      zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/service/impl/ActivityGoodsPriceServiceImpl.java
  61. 12 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/service/impl/ActivityRecommendServiceImpl.java
  62. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/vo/ActivityRecommendVo.java
  63. 4 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/bo/OssRequest.java
  64. 12 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/OssService.java
  65. 114 18
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/impl/OssServiceImpl.java
  66. 2 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alisms/service/IAliSmsService.java
  67. 39 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alisms/service/impl/AliSmsServiceImpl.java
  68. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/ExamAddBo.java
  69. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/ExamEditBo.java
  70. 6 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionAddBo.java
  71. 8 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionBusinessAddBo.java
  72. 7 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionEditBo.java
  73. 46 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionOtherAddBo.java
  74. 52 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionOtherEditBo.java
  75. 49 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionOtherQueryBo.java
  76. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/domain/Exam.java
  77. 4 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/domain/Question.java
  78. 41 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/domain/QuestionOld.java
  79. 36 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/domain/QuestionOldChild.java
  80. 28 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/domain/QuestionOldOptions.java
  81. 48 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/domain/QuestionOther.java
  82. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionChapterExamMapper.java
  83. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionMapper.java
  84. 14 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionOtherMapper.java
  85. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IExamService.java
  86. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionChapterExamService.java
  87. 55 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionOtherService.java
  88. 16 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionService.java
  89. 1 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/ExamQuestionServiceImpl.java
  90. 71 10
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/ExamServiceImpl.java
  91. 1 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionBusinessServiceImpl.java
  92. 6 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionChapterExamServiceImpl.java
  93. 1 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionChapterServiceImpl.java
  94. 1 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionModuleChapterServiceImpl.java
  95. 1 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionModuleServiceImpl.java
  96. 305 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionOtherServiceImpl.java
  97. 1067 144
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java
  98. 7 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/vo/ExamVo.java
  99. 27 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/vo/ExternalQuestionChildTopicVo.java
  100. 20 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/vo/ExternalQuestionChildVo.java

BIN
zhongzheng-admin-data/.mvn/wrapper/maven-wrapper.jar


+ 2 - 0
zhongzheng-admin-data/.mvn/wrapper/maven-wrapper.properties

@@ -0,0 +1,2 @@
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.3/apache-maven-3.9.3-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar

+ 1 - 1
zhongzheng-admin-data/src/main/java/com/zhongzheng/controller/common/UserStudyLogController.java

@@ -128,7 +128,7 @@ public class UserStudyLogController extends BaseController {
     @PreAuthorize("@ss.hasPermi('system:log:list')")
     @GetMapping("/weekStudy/list")
     public TableDataInfo<CdUserStudyLogVo> weekStudyList(CdUserStudyLogQueryBo bo) {
-        if (!ToolsUtils.checkSignFromOldSys(bo.getStamp(), bo.getSign())) {
+       if (!ToolsUtils.checkSignFromOldSys(bo.getStamp(), bo.getSign())) {
             throw new CustomException("签名错误");
         }
         startPage();

+ 67 - 5
zhongzheng-admin-data/src/main/resources/application-dev.yml

@@ -4,9 +4,9 @@ spring:
         type: com.alibaba.druid.pool.DruidDataSource
         driverClassName: com.mysql.cj.jdbc.Driver
         druid:
-            url: jdbc:mysql://39.108.7.155:3306/zz_edu_data_dev?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
+            url: jdbc:mysql://192.168.1.222:3306/zz_edu_saas?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
             username: root
-            password: gdxy2023#@#zzkj
+            password: zhongzheng2021
             # 初始连接数
             initialSize: 5
             # 最小连接池数量
@@ -77,7 +77,7 @@ aliyun:
         policy:
             expire: 30 # 签名有效期(S)
         maxSize: 100 # 上传文件大小(M)
-        callback: http://120.79.166.78:19004/aliyun/oss/callback # 文件上传成功后的回调地址
+        callback: http://120.79.166.78:19013/aliyun/oss/callback # 文件上传成功后的回调地址
         dir:
             prefix: oss/images/ # 上传文件夹路径前缀 `
 
@@ -121,7 +121,7 @@ certificate:
 
 liveGotoURL: http://
 
-enCodeVersion: develop
+enCodeVersion: trial
 
 oldStudySys:
     syncPath: http://gdxypx.xy.com/System/BussinessApi/PostUserStudyRecords
@@ -133,18 +133,80 @@ oldStudySys:
     classUserListPath: http://gdxypx.xy.com/System/BussinessApi/UserCourseCategoryListcno
     classOpenPath: http://gdxypx.xy.com/System/BussinessApi/OpenClass
     salePassword: http://gdxypx.xy.com/WitSystem/BussinessApi/GetSaleInfo
+    updateInvoicePath: http://gdxypx.xy.com/system/BussinessApi/UpdateInvoiceData
+    createExamPath: http://gdxypx.xy.com/system/BussinessApi/CreateSameClass
 
 officialPush:
-    infoPath: https://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
+    infoPath: closehttps://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
     periodPath: https://jypt-dev.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: peixunjigou
     token: 0ca175b9c0f726a831d895e26933246
+    sevenInfoPath: http://sgry-dev.gdcic.net/organjxjy/ShangBaoMingdan
+    sevenPeriodPath: http://sgry-dev.gdcic.net/organjxjy/XueshiShenqing
 
 
 distributionOldPay:
     host: http://gdxypx.xy.com/System/BussinessApi/AddRedPackData
 
+handouts:
+    savePath: http://192.168.1.7:9090/course/handouts/save
+    updatePath: http://192.168.1.7:9090/course/handouts/edit
+
+Nuonuo:
+    host: https://sdk.nuonuo.com/open/v1/services
+    APPkey: 39149760
+    APPSecret: 07168A248B2844E0
+
+oldOrder:
+    studyRecord: http://gdxypx.xy.com/WitSystem/BussinessApi/GetStudyRecord
+    orderCheck: http://gdxypx.xy.com/WitSystem/BussinessApi/AuditUnderOrder
+    finishOrder: http://gdxypx.xy.com/WitSystem/BussinessApi/CompleteOrder
+    refuseCheck: http://gdxypx.xy.com/WitSystem/BussinessApi/ReFundAuditResult
+    inputOrderSn: http://gdxypx.xy.com/WitSystem/BussinessApi/GetNewYxtinputOrderSn
+    checkOrderStudent: http://gdxypx.xy.com/WitSystem/BussinessApi/ReAuditUnderOrder
+    checkOrderBrokerage: http://gdxypx.xy.com/WitSystem/BussinessApi/CommissionRate
+    refundPay: http://192.168.1.222:5030/common/platform/pay
+    refundPayHandle: http://192.168.1.222:5030/common/platform/pay/handle
+    updateRemark: http://gdxypx.xy.com/WitSystem/BussinessApi/UpdateOrderAuditRemark
+
+oldSys:
+    host: http://gdxypx.xy.com
+    goods: http://gdxypx.xy.com/WitSystem/BussinessApi/NewYxtLogin
+    question: http://192.168.1.121:8057/WordData/GetMeasureList
+    questionDetail: http://192.168.1.121:8057/WordData/GetTopicList
+
+invoice:
+    host: http://192.168.1.222:7077/sys/common/openMplatform/log
+
+liveHost: http://192.168.1.222:6009
+
+fileHost: http://192.168.1.24:9099
+
 exam:
+    applySave: http://192.168.1.7:9099/cd/exam/save
+    applyUpdate: http://192.168.1.7:9099/cd/exam/update
+    applyDelete: http://192.168.1.7:9099/cd/exam/delete
+    subscribeSave: http://192.168.1.7:9099/cd/subscribe/save
+    subscribeSaveExam: http://192.168.1.7:9099/cd/subscribe/save/exam
+    subscribeUpdateExam: http://192.168.1.7:9099/cd/subscribe/update/exam
+    subscribeAddExamNum: http://192.168.1.7:9099/cd/subscribe/add/num
+    question: http://120.79.166.78:19013/common/question/getMeasureList
+    questionDetail: http://120.79.166.78:19013/common/question/getTopicList
     subscribe: http://192.168.1.222:5030/common/apply/subscribe
     cancelSubscribe: http://192.168.1.222:5030/common/apply/subscribe/cancel
 
+shared:
+    statistics: http://gdxypx.xy.com/WitSystem/BussinessApi/HighSeasData
+    customer: http://gdxypx.xy.com/WitSystem/BussinessApi/CustomerStatsData
+    cert: http://gdxypx.xy.com/WitSystem/BussinessApi/CertStatsData
+    orderArea: http://gdxypx.xy.com/WitSystem/BussinessApi/OrderAreaData
+    rateData: http://gdxypx.xy.com//WitSystem/BussinessApi/CustomerConversionRateData
+    rateTrend: http://gdxypx.xy.com/WitSystem/BussinessApi/CustomerConversionRateTrendData
+    customerOrder: http://gdxypx.xy.com/WitSystem/BussinessApi/CustomerOrderData
+    tenantData: http://gdxypx.xy.com/witsystem/bussinessapi/GetOrgList
+    saleData: http://gdxypx.xy.com/witsystem/bussinessapi/GetSaleListByOrgId
+
+ZsBank:
+    publickey: BNsIe9U0x8IeSe4h/dxUzVEz9pie0hDSfMRINRXc7s1UIXfkExnYECF4QqJ2SnHxLv3z/99gsfDQrQ6dzN5lZj0=
+    privatekey: NBtl7WnuUtA2v5FaebEkU0/Jj1IodLGT6lQqwkzmd2E=
+    sm4key: VuAzSWQhsoNqzn0K

+ 88 - 27
zhongzheng-admin-data/src/main/resources/application-prod.yml

@@ -4,9 +4,9 @@ spring:
         type: com.alibaba.druid.pool.DruidDataSource
         driverClassName: com.mysql.cj.jdbc.Driver
         druid:
-            url: jdbc:mysql://39.108.7.155:3306/zz_edu_data_prod?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
+            url: jdbc:mysql://rm-wz950fu2v70864v85.mysql.rds.aliyuncs.com/zz_edu_saas?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
             username: root
-            password: gdxy2023#@#zzkj
+            password: gdxy2021!@#zzjykj
             # 初始连接数
             initialSize: 5
             # 最小连接池数量
@@ -53,7 +53,7 @@ spring:
         # 端口,默认为6379
         port: 6379
         # 数据库索引
-        database: 1
+        database: 0
         # 密码
         password: zhongzheng2021_redis
         # 连接超时时间
@@ -70,14 +70,14 @@ spring:
                 max-wait: -1ms
 aliyun:
     oss:
-        endpoint: https://file-dev.xyyxt.net # oss对外服务的访问域名
+        endpoint: https://file.xyyxt.net # oss对外服务的访问域名
         accessKeyId: LTAIgC8O2WUXvXuR  # 访问身份验证中用到用户标识
         accessKeySecret: 1yyCazuT1M6MruBXzgFjP0p9gdMlwX # 用户用于加密签名字符串和oss用来验证签名字符串的密钥
-        bucketName: zhongzheng-test # oss的存储空间
+        bucketName: zhongzheng-prod # oss的存储空间
         policy:
             expire: 30 # 签名有效期(S)
         maxSize: 100 # 上传文件大小(M)
-        callback: http://120.79.166.78:19004/aliyun/oss/callback # 文件上传成功后的回调地址
+        callback: https://cloud.xyyxt.net/aliyun/oss/callback # 文件上传成功后的回调地址
         dir:
             prefix: oss/images/ # 上传文件夹路径前缀 `
 
@@ -106,45 +106,106 @@ wx:
         mchid: 1342013901
         key: GdXyPxYjZx1234123yJzXgDxYpXyjpx9
         appsecret: GdXyPxYjZx1234123yJzXgDxYpXyjpx9
-        notifyUrl: http://120.79.166.78:19012/wx/pay/callback
+        notifyUrl: https://api.xyyxt.net/wx/pay/callback
     scanLogin:
-        host: https://testm.xyyxt.net/
+        host: https://m.xyyxt.net/
 
 wisdomExamRoom:
     mchid: 10001
     appid: ZZ-YXT-GZ-20220820-0001
     app_secret: mt70O1s/Xd5LwuH7yHLpj9R+tKUn5j9vTnCvmgBnbJDA11Hpl7+q4lEZliqPAjN+YHPn9bGmHkAbw5XwhhMiYg==
-    host:  http://bg.sam457.site:9020
+    host: http://bg.sam457.site:9020
 
 certificate:
-    host: http://192.168.1.38:8000/
+    host: https://m.xyyxt.net/
 
-liveGotoURL: http://
+liveGotoURL: https://
 
-enCodeVersion: develop
+enCodeVersion: release
 
 oldStudySys:
-    syncPath: http://gdxypx.xy.com/System/BussinessApi/PostUserStudyRecords
-    sharePath: http://192.168.1.210:8086/witsystem/dataapi/SaleOrder
-    shareCanclePath: http://192.168.1.210:8086/witsystem/dataapi/ordercance
-    searchGradeCount: http://gdxypx.xy.com/System/BussinessApi/OfficialGradeCount
-    pushGradeCount: http://gdxypx.xy.com/System/BussinessApi/OfficialGradeCountAuto
-    educationalInspector: http://192.168.1.210/EduSystem/BusinessApi/NewYxtUserPrompt
-    classUserListPath: http://gdxypx.xy.com/System/BussinessApi/UserCourseCategoryListcno
-    classOpenPath: http://gdxypx.xy.com/System/BussinessApi/OpenClass
-    salePassword: http://gdxypx.xy.com/WitSystem/BussinessApi/GetSaleInfo
+    syncPath: https://www.xyyxt.net/System/BussinessApi/PostUserStudyRecords
+    sharePath: https://www.xyyxt.net/witsystem/dataapi/SaleOrder
+    shareCanclePath: https://www.xyyxt.net/witsystem/dataapi/ordercance
+    searchGradeCount: https://www.xyyxt.net/System/BussinessApi/OfficialGradeCount
+    pushGradeCount: https://www.xyyxt.net/System/BussinessApi/OfficialGradeCountAuto
+    educationalInspector: https://zs.gdzzkj.net/EduSystem/BusinessApi/NewYxtUserPrompt
+    classUserListPath: https://www.xyyxt.net/System/BussinessApi/UserCourseCategoryListcno
+    classOpenPath: https://www.xyyxt.net/System/BussinessApi/OpenClass
+    salePassword: http://www.xyyxt.net/WitSystem/BussinessApi/GetSaleInfo
+    updateInvoicePath: http://www.xyyxt.net/system/BussinessApi/UpdateInvoiceData
+    createExamPath: http://www.xyyxt.net/system/BussinessApi/CreateSameClass
 
 officialPush:
-    infoPath: https://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
-    periodPath: https://jypt-dev.gdcic.net/organjxjy/XueshiShenqing
-    infoAccount: peixunjigou
-    token: 0ca175b9c0f726a831d895e26933246
-
+    infoPath: https://jypt.gdcic.net/organjxjy/ShangBaoMingdan
+    periodPath: https://jypt.gdcic.net/organjxjy/XueshiShenqing
+    infoAccount: GDSXY
+    token: 01b5d9833987efdff54483cdc9720da6
+    sevenInfoPath: http://sgry.gdcic.net/organjxjy/ShangBaoMingdan
+    sevenPeriodPath: http://sgry.gdcic.net/organjxjy/XueshiShenqing
 
 distributionOldPay:
-    host: http://gdxypx.xy.com/System/BussinessApi/AddRedPackData
+    host: https://www.xyyxt.net/System/BussinessApi/AddRedPackData
+
+handouts:
+    savePath: https://attach.xyyxt.net/course/handouts/save
+    updatePath: https://attach.xyyxt.net/course/handouts/edit
+
+Nuonuo:
+    host: https://sdk.nuonuo.com/open/v1/services
+    APPkey: 39149760
+    APPSecret: 07168A248B2844E0
+
+oldOrder:
+    studyRecord: http://www.xyyxt.net/WitSystem/BussinessApi/GetStudyRecord
+    orderCheck: http://www.xyyxt.net/WitSystem/BussinessApi/AuditUnderOrder
+    finishOrder: http://www.xyyxt.net/WitSystem/BussinessApi/CompleteOrder
+    refuseCheck: http://www.xyyxt.net/WitSystem/BussinessApi/ReFundAuditResult
+    inputOrderSn: http://www.xyyxt.net/WitSystem/BussinessApi/GetNewYxtinputOrderSn
+    checkOrderStudent: http://www.xyyxt.net/WitSystem/BussinessApi/ReAuditUnderOrder
+    checkOrderBrokerage: http://www.xyyxt.net/WitSystem/BussinessApi/CommissionRate
+    refundPay: https://cloud.xyyxt.net/common/platform/pay
+    refundPayHandle: https://cloud.xyyxt.net/common/platform/pay/handle
+    updateRemark: http://www.xyyxt.net/WitSystem/BussinessApi/UpdateOrderAuditRemark
+
+oldSys:
+    host: http://www.xyyxt.net
+    goods: http://www.xyyxt.net/system/BussinessApi/NewYxtLogin
+    question: http://192.168.1.121:8057/WordData/GetMeasureList
+    questionDetail: http://192.168.1.121:8057/WordData/GetTopicList
+
+invoice:
+    host: https://ptapi.gdzzkj.net/sys/common/openMplatform/log
+
+liveHost: https://sso.xyyxt.net
+
+fileHost: http://39.108.7.155:9099
 
 exam:
+    applySave: http://39.108.7.155:9099/cd/exam/save
+    applyUpdate: http://39.108.7.155:9099/cd/exam/update
+    applyDelete: http://39.108.7.155:9099/cd/exam/delete
+    subscribeSave: http://39.108.7.155:9099/cd/subscribe/save
+    subscribeSaveExam: http://39.108.7.155:9099/cd/subscribe/save/exam
+    subscribeUpdateExam: http://39.108.7.155:9099/cd/subscribe/update/exam
+    subscribeAddExamNum: http://39.108.7.155:9099/cd/subscribe/add/num
+    question: http://120.79.166.78:19013/common/question/getMeasureList
+    questionDetail: http://120.79.166.78:19013/common/question/getTopicList
     subscribe: http://192.168.1.222:5030/common/apply/subscribe
     cancelSubscribe: http://192.168.1.222:5030/common/apply/subscribe/cancel
 
+shared:
+    statistics: http://www.xyyxt.net/WitSystem/BussinessApi/HighSeasData
+    customer: http://www.xyyxt.net/WitSystem/BussinessApi/CustomerStatsData
+    cert: http://www.xyyxt.net/WitSystem/BussinessApi/CertStatsData
+    orderArea: http://www.xyyxt.net/WitSystem/BussinessApi/OrderAreaData
+    rateData: http://www.xyyxt.net//WitSystem/BussinessApi/CustomerConversionRateData
+    rateTrend: http://www.xyyxt.net/WitSystem/BussinessApi/CustomerConversionRateTrendData
+    customerOrder: http://www.xyyxt.net/WitSystem/BussinessApi/CustomerOrderData
+    tenantData: http://www.xyyxt.net/witsystem/bussinessapi/GetOrgList
+    saleData: http://www.xyyxt.net/witsystem/bussinessapi/GetSaleListByOrgId
+
+ZsBank:
+    publickey: BNsIe9U0x8IeSe4h/dxUzVEz9pie0hDSfMRINRXc7s1UIXfkExnYECF4QqJ2SnHxLv3z/99gsfDQrQ6dzN5lZj0=
+    privatekey: NBtl7WnuUtA2v5FaebEkU0/Jj1IodLGT6lQqwkzmd2E=
+    sm4key: VuAzSWQhsoNqzn0K

BIN
zhongzheng-admin-data/src/main/resources/config/1342013901/apiclient_cert.p12


BIN
zhongzheng-admin-data/src/main/resources/config/1637492608/apiclient_cert.p12


BIN
zhongzheng-admin-data/src/main/resources/config/1640084970/apiclient_cert.p12


+ 7 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/CommonController.java

@@ -12,6 +12,7 @@ import com.zhongzheng.common.utils.file.FileUploadUtils;
 import com.zhongzheng.common.utils.file.FileUtils;
 import com.zhongzheng.framework.config.ServerConfig;
 import com.zhongzheng.modules.alioss.bo.FileHandleBo;
+import com.zhongzheng.modules.user.bo.UserDownloadBo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -198,4 +199,10 @@ public class CommonController extends BaseController {
         }
     }
 
+    @PostMapping("/common/user/data/download")
+    public AjaxResult userDateDownload(@RequestBody UserDownloadBo bo){
+
+        return AjaxResult.success();
+    }
+
 }

+ 67 - 4
zhongzheng-admin/src/main/resources/application-dev.yml

@@ -77,7 +77,7 @@ aliyun:
         policy:
             expire: 30 # 签名有效期(S)
         maxSize: 100 # 上传文件大小(M)
-        callback: http://120.79.166.78:19004/aliyun/oss/callback # 文件上传成功后的回调地址
+        callback: http://120.79.166.78:19013/aliyun/oss/callback # 文件上传成功后的回调地址
         dir:
             prefix: oss/images/ # 上传文件夹路径前缀 `
 
@@ -121,7 +121,7 @@ certificate:
 
 liveGotoURL: http://
 
-enCodeVersion: develop
+enCodeVersion: trial
 
 oldStudySys:
     syncPath: http://gdxypx.xy.com/System/BussinessApi/PostUserStudyRecords
@@ -133,17 +133,80 @@ oldStudySys:
     classUserListPath: http://gdxypx.xy.com/System/BussinessApi/UserCourseCategoryListcno
     classOpenPath: http://gdxypx.xy.com/System/BussinessApi/OpenClass
     salePassword: http://gdxypx.xy.com/WitSystem/BussinessApi/GetSaleInfo
+    updateInvoicePath: http://gdxypx.xy.com/system/BussinessApi/UpdateInvoiceData
+    createExamPath: http://gdxypx.xy.com/system/BussinessApi/CreateSameClass
 
 officialPush:
-    infoPath: https://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
+    infoPath: closehttps://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
     periodPath: https://jypt-dev.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: peixunjigou
     token: 0ca175b9c0f726a831d895e26933246
+    sevenInfoPath: http://sgry-dev.gdcic.net/organjxjy/ShangBaoMingdan
+    sevenPeriodPath: http://sgry-dev.gdcic.net/organjxjy/XueshiShenqing
 
 
 distributionOldPay:
-    host: http://gdxypx.xy.com/System/BussinessApi/AddRedPackData\
+    host: http://gdxypx.xy.com/System/BussinessApi/AddRedPackData
+
+handouts:
+    savePath: http://192.168.1.7:9090/course/handouts/save
+    updatePath: http://192.168.1.7:9090/course/handouts/edit
+
+Nuonuo:
+    host: https://sdk.nuonuo.com/open/v1/services
+    APPkey: 39149760
+    APPSecret: 07168A248B2844E0
+
+oldOrder:
+    studyRecord: http://gdxypx.xy.com/WitSystem/BussinessApi/GetStudyRecord
+    orderCheck: http://gdxypx.xy.com/WitSystem/BussinessApi/AuditUnderOrder
+    finishOrder: http://gdxypx.xy.com/WitSystem/BussinessApi/CompleteOrder
+    refuseCheck: http://gdxypx.xy.com/WitSystem/BussinessApi/ReFundAuditResult
+    inputOrderSn: http://gdxypx.xy.com/WitSystem/BussinessApi/GetNewYxtinputOrderSn
+    checkOrderStudent: http://gdxypx.xy.com/WitSystem/BussinessApi/ReAuditUnderOrder
+    checkOrderBrokerage: http://gdxypx.xy.com/WitSystem/BussinessApi/CommissionRate
+    refundPay: http://192.168.1.222:5030/common/platform/pay
+    refundPayHandle: http://192.168.1.222:5030/common/platform/pay/handle
+    updateRemark: http://gdxypx.xy.com/WitSystem/BussinessApi/UpdateOrderAuditRemark
+
+oldSys:
+    host: http://gdxypx.xy.com
+    goods: http://gdxypx.xy.com/WitSystem/BussinessApi/NewYxtLogin
+    question: http://192.168.1.121:8057/WordData/GetMeasureList
+    questionDetail: http://192.168.1.121:8057/WordData/GetTopicList
+
+invoice:
+    host: http://192.168.1.222:7077/sys/common/openMplatform/log
+
+liveHost: http://192.168.1.222:6009
+
+fileHost: http://192.168.1.24:9099
 
 exam:
+    applySave: http://192.168.1.7:9099/cd/exam/save
+    applyUpdate: http://192.168.1.7:9099/cd/exam/update
+    applyDelete: http://192.168.1.7:9099/cd/exam/delete
+    subscribeSave: http://192.168.1.7:9099/cd/subscribe/save
+    subscribeSaveExam: http://192.168.1.7:9099/cd/subscribe/save/exam
+    subscribeUpdateExam: http://192.168.1.7:9099/cd/subscribe/update/exam
+    subscribeAddExamNum: http://192.168.1.7:9099/cd/subscribe/add/num
+    question: http://120.79.166.78:19013/common/question/getMeasureList
+    questionDetail: http://120.79.166.78:19013/common/question/getTopicList
     subscribe: http://192.168.1.222:5030/common/apply/subscribe
     cancelSubscribe: http://192.168.1.222:5030/common/apply/subscribe/cancel
+
+shared:
+    statistics: http://gdxypx.xy.com/WitSystem/BussinessApi/HighSeasData
+    customer: http://gdxypx.xy.com/WitSystem/BussinessApi/CustomerStatsData
+    cert: http://gdxypx.xy.com/WitSystem/BussinessApi/CertStatsData
+    orderArea: http://gdxypx.xy.com/WitSystem/BussinessApi/OrderAreaData
+    rateData: http://gdxypx.xy.com//WitSystem/BussinessApi/CustomerConversionRateData
+    rateTrend: http://gdxypx.xy.com/WitSystem/BussinessApi/CustomerConversionRateTrendData
+    customerOrder: http://gdxypx.xy.com/WitSystem/BussinessApi/CustomerOrderData
+    tenantData: http://gdxypx.xy.com/witsystem/bussinessapi/GetOrgList
+    saleData: http://gdxypx.xy.com/witsystem/bussinessapi/GetSaleListByOrgId
+
+ZsBank:
+    publickey: BNsIe9U0x8IeSe4h/dxUzVEz9pie0hDSfMRINRXc7s1UIXfkExnYECF4QqJ2SnHxLv3z/99gsfDQrQ6dzN5lZj0=
+    privatekey: NBtl7WnuUtA2v5FaebEkU0/Jj1IodLGT6lQqwkzmd2E=
+    sm4key: VuAzSWQhsoNqzn0K

+ 62 - 0
zhongzheng-admin/src/main/resources/application-prod.yml

@@ -133,17 +133,79 @@ oldStudySys:
     classUserListPath: https://www.xyyxt.net/System/BussinessApi/UserCourseCategoryListcno
     classOpenPath: https://www.xyyxt.net/System/BussinessApi/OpenClass
     salePassword: http://www.xyyxt.net/WitSystem/BussinessApi/GetSaleInfo
+    updateInvoicePath: http://www.xyyxt.net/system/BussinessApi/UpdateInvoiceData
+    createExamPath: http://www.xyyxt.net/system/BussinessApi/CreateSameClass
 
 officialPush:
     infoPath: https://jypt.gdcic.net/organjxjy/ShangBaoMingdan
     periodPath: https://jypt.gdcic.net/organjxjy/XueshiShenqing
     infoAccount: GDSXY
     token: 01b5d9833987efdff54483cdc9720da6
+    sevenInfoPath: http://sgry.gdcic.net/organjxjy/ShangBaoMingdan
+    sevenPeriodPath: http://sgry.gdcic.net/organjxjy/XueshiShenqing
 
 distributionOldPay:
     host: https://www.xyyxt.net/System/BussinessApi/AddRedPackData
 
+handouts:
+    savePath: https://attach.xyyxt.net/course/handouts/save
+    updatePath: https://attach.xyyxt.net/course/handouts/edit
+
+Nuonuo:
+    host: https://sdk.nuonuo.com/open/v1/services
+    APPkey: 39149760
+    APPSecret: 07168A248B2844E0
+
+oldOrder:
+    studyRecord: http://www.xyyxt.net/WitSystem/BussinessApi/GetStudyRecord
+    orderCheck: http://www.xyyxt.net/WitSystem/BussinessApi/AuditUnderOrder
+    finishOrder: http://www.xyyxt.net/WitSystem/BussinessApi/CompleteOrder
+    refuseCheck: http://www.xyyxt.net/WitSystem/BussinessApi/ReFundAuditResult
+    inputOrderSn: http://www.xyyxt.net/WitSystem/BussinessApi/GetNewYxtinputOrderSn
+    checkOrderStudent: http://www.xyyxt.net/WitSystem/BussinessApi/ReAuditUnderOrder
+    checkOrderBrokerage: http://www.xyyxt.net/WitSystem/BussinessApi/CommissionRate
+    refundPay: https://cloud.xyyxt.net/common/platform/pay
+    refundPayHandle: https://cloud.xyyxt.net/common/platform/pay/handle
+    updateRemark: http://www.xyyxt.net/WitSystem/BussinessApi/UpdateOrderAuditRemark
+
+oldSys:
+    host: http://www.xyyxt.net
+    goods: http://www.xyyxt.net/system/BussinessApi/NewYxtLogin
+    question: http://192.168.1.121:8057/WordData/GetMeasureList
+    questionDetail: http://192.168.1.121:8057/WordData/GetTopicList
+
+invoice:
+    host: https://ptapi.gdzzkj.net/sys/common/openMplatform/log
+
+liveHost: https://sso.xyyxt.net
+
+fileHost: http://39.108.7.155:9099
+
 exam:
+    applySave: http://39.108.7.155:9099/cd/exam/save
+    applyUpdate: http://39.108.7.155:9099/cd/exam/update
+    applyDelete: http://39.108.7.155:9099/cd/exam/delete
+    subscribeSave: http://39.108.7.155:9099/cd/subscribe/save
+    subscribeSaveExam: http://39.108.7.155:9099/cd/subscribe/save/exam
+    subscribeUpdateExam: http://39.108.7.155:9099/cd/subscribe/update/exam
+    subscribeAddExamNum: http://39.108.7.155:9099/cd/subscribe/add/num
+    question: http://120.79.166.78:19013/common/question/getMeasureList
+    questionDetail: http://120.79.166.78:19013/common/question/getTopicList
     subscribe: http://192.168.1.222:5030/common/apply/subscribe
     cancelSubscribe: http://192.168.1.222:5030/common/apply/subscribe/cancel
 
+shared:
+    statistics: http://www.xyyxt.net/WitSystem/BussinessApi/HighSeasData
+    customer: http://www.xyyxt.net/WitSystem/BussinessApi/CustomerStatsData
+    cert: http://www.xyyxt.net/WitSystem/BussinessApi/CertStatsData
+    orderArea: http://www.xyyxt.net/WitSystem/BussinessApi/OrderAreaData
+    rateData: http://www.xyyxt.net//WitSystem/BussinessApi/CustomerConversionRateData
+    rateTrend: http://www.xyyxt.net/WitSystem/BussinessApi/CustomerConversionRateTrendData
+    customerOrder: http://www.xyyxt.net/WitSystem/BussinessApi/CustomerOrderData
+    tenantData: http://www.xyyxt.net/witsystem/bussinessapi/GetOrgList
+    saleData: http://www.xyyxt.net/witsystem/bussinessapi/GetSaleListByOrgId
+
+ZsBank:
+    publickey: BNsIe9U0x8IeSe4h/dxUzVEz9pie0hDSfMRINRXc7s1UIXfkExnYECF4QqJ2SnHxLv3z/99gsfDQrQ6dzN5lZj0=
+    privatekey: NBtl7WnuUtA2v5FaebEkU0/Jj1IodLGT6lQqwkzmd2E=
+    sm4key: VuAzSWQhsoNqzn0K

BIN
zhongzheng-admin/src/main/resources/zhiyuan1689758857592/【建筑】2023年二建黄金卷(二)(1).docx


BIN
zhongzheng-admin/src/main/resources/zhiyuan1690785560230/法规——黄金卷.zip


+ 16 - 6
zhongzheng-common/pom.xml

@@ -69,6 +69,11 @@
             <version>1.4.17</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.nuonuo</groupId>
+            <artifactId>open-sdk</artifactId>
+            <version>1.0.5.2</version>
+        </dependency>
         <!-- 保利威 -->
         <dependency>
             <groupId>net.polyv</groupId>
@@ -91,7 +96,7 @@
         <dependency>
             <groupId>com.aliyun.oss</groupId>
             <artifactId>aliyun-sdk-oss</artifactId>
-            <version>3.10.2</version>
+            <version>3.15.2</version>
         </dependency>
 
         <dependency>
@@ -183,11 +188,11 @@
         </dependency>
 
         <!-- dynamic -->
-        <dependency>
-            <groupId>com.baomidou</groupId>
-            <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
-            <version>3.0.0</version>
-        </dependency>
+<!--        <dependency>-->
+<!--            <groupId>com.baomidou</groupId>-->
+<!--            <artifactId>dynamic-datasource-spring-boot-starter</artifactId>-->
+<!--            <version>3.0.0</version>-->
+<!--        </dependency>-->
 
         <dependency>
             <groupId>com.baomidou</groupId>
@@ -232,6 +237,11 @@
             <groupId>io.undertow</groupId>
             <artifactId>undertow-core</artifactId>
         </dependency>
+        <dependency>
+            <groupId>javax.mail</groupId>
+            <artifactId>mail</artifactId>
+            <version>1.4.7</version>
+        </dependency>
 
     </dependencies>
 

+ 1 - 1
zhongzheng-common/src/main/java/com/zhongzheng/common/core/domain/entity/SysDictData.java

@@ -71,7 +71,7 @@ public class SysDictData implements Serializable
     private String listClass;
 
     @TableField(value = "tenant_id")
-    private Long tenantId;
+    private String tenantId;
 
     /** 是否默认(Y是 N否) */
     @Excel(name = "是否默认", readConverterExp = "Y=是,N=否")

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/user/domain/TopSysRole.java → zhongzheng-common/src/main/java/com/zhongzheng/common/core/domain/entity/TopSysRole.java

@@ -1,4 +1,4 @@
-package com.zhongzheng.modules.top.user.domain;
+package com.zhongzheng.common.core.domain.entity;
 
 import com.baomidou.mybatisplus.annotation.*;
 import com.zhongzheng.common.annotation.Excel;

+ 2 - 2
zhongzheng-common/src/main/java/com/zhongzheng/common/core/domain/entity/TopSysUser.java

@@ -144,11 +144,11 @@ public class TopSysUser implements Serializable
 
     /** 角色对象 */
     @TableField(exist = false)
-    private List<SysRole> roles;
+    private List<TopSysRole> roles;
 
     /** 角色组 */
     @TableField(exist = false)
-    private Long[] roleIds;
+    private List<Long> roleIds;
 
     /** 角色名称 */
     @TableField(exist = false)

+ 109 - 0
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/DateUtils.java

@@ -275,6 +275,29 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return cal.getTimeInMillis() / 1000;  //今天凌晨
     }
 
+    /**
+     * 获取指定时间的凌晨时间戳
+     */
+    public static Long getScheduleTimeStrZeroTime(String timeStr,String patternStr)
+    {
+        Long time = dateTimeSec(patternStr,timeStr);
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(timeToDate(time));
+        cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
+        return cal.getTimeInMillis() / 1000;  //今天凌晨
+    }
+
+    /**
+     * 获取指定时间的凌晨时间戳
+     */
+    public static Long getScheduleTimeZeroTime(Long scheduleTime)
+    {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(timeToDate(scheduleTime));
+        cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
+        return cal.getTimeInMillis() / 1000;  //今天凌晨
+    }
+
     public static String formatDate(Date time,String str)
     {
         SimpleDateFormat sdf = new SimpleDateFormat(str);
@@ -304,6 +327,18 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return cal.getTime().getTime()/1000;
     }
 
+    /**
+     * 获取本年第一天的凌晨时间戳
+     */
+    public static Long getToYearZeroTime()
+    {
+        Calendar calendar = Calendar.getInstance();
+        // 设置当前时间为年初的第一天
+        calendar.set(Calendar.DAY_OF_YEAR, 1);
+        Date startOfCurrentYear = calendar.getTime();
+        return startOfCurrentYear.getTime()/1000;
+    }
+
     /**
      * 根据当前日期获得所在周的日期区间(周一和周日日期)
      */
@@ -598,4 +633,78 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return c.getTime().getTime()/1000;
     }
 
+
+    public static List<Long> getWeekData(Long dataTime){
+        List<Long> week = new ArrayList();
+        Calendar calendar = Calendar.getInstance();
+        Long zeroTime = DateUtils.getScheduleTimeZeroTime(dataTime);
+        calendar.setTime(timeToDate(zeroTime));
+        // 如果是周日
+        if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
+            calendar.add(Calendar.DAY_OF_YEAR,-1);
+        }
+        // 获取当前日期是当周的第i天
+        int i = calendar.get(Calendar.DAY_OF_WEEK) - 1;
+        // 获取当前日期所在周的第一天
+        calendar.add(Calendar.DATE , -i);
+
+        for (int j = 0; j < 7; j++) {
+            if(j >0){
+                calendar.add(Calendar.DATE , 1);
+            }
+            Long time = calendar.getTime().getTime()/1000;
+            if (j == 6){
+                time = time + 86400L;
+            }
+            week.add(time);
+        }
+        return week;
+    }
+
+
+    public static Map<Long,Long> getWeekTime(Long startTime,Long endTime){
+        Map<Long,Long> mapList = new LinkedHashMap<>();
+        Long zeroTime = DateUtils.getScheduleTimeZeroTime(startTime);
+        //一天的时间戳
+        Long time = 86400L;
+        for (Long i = zeroTime; i <= endTime; i = i+time) {
+            List<Long> weekData = DateUtils.getWeekData(i);
+            mapList.put(weekData.get(0),weekData.get(weekData.size()-1));
+        }
+        return mapList;
+    }
+
+    public static Map<Long,Long> getMonthTime(Long startTime,Long endTime){
+        //一天的时间戳
+        Long time = 86400L;
+        Map<Long,Long> map = new  LinkedHashMap<>();
+        try{
+            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
+            Date d1 = DateUtils.timeToDate(startTime);
+            Date d2 = DateUtils.timeToDate(endTime);
+            Calendar dd = Calendar.getInstance();//定义日期实例
+            dd.setTime(d1);//设置日期起始时间
+            while (dd.getTime().before(d2)) {//判断是否到结束日期
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
+                String str = sdf.format(dd.getTime());
+                Calendar c = Calendar.getInstance();
+                c.setTime(format.parse(str));
+                c.add(Calendar.MONTH, 0);
+                c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
+                Long start = c.getTime().getTime()/1000;
+                dd.setTime(DateUtils.timeToDate(start));
+                //获取当前月最后一天
+                Calendar ca = Calendar.getInstance();
+                ca.setTime(format.parse(str));
+                ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
+                Long end = ca.getTime().getTime()/1000 + time;
+                map.put(start,end);
+                dd.add(Calendar.MONTH, 1);//进行当前日期月份加1
+            }
+        }catch (Exception e){
+            System.out.println("异常"+e.getMessage());
+        }
+        return map;
+    }
+
 }

+ 46 - 0
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/JavaMailUtils.java

@@ -0,0 +1,46 @@
+package com.zhongzheng.common.utils;
+
+
+import javax.mail.Authenticator;
+import javax.mail.PasswordAuthentication;
+import javax.mail.Session;
+import java.util.Properties;
+
+/**
+ * @author yangdamao
+ * @date 2023年06月19日 10:11
+ */
+public class JavaMailUtils {
+
+    public static Session createsession(String postAccount,String postPassword,String STMPserver,String post) {
+        // SMTP服务器地址
+        String smtp = STMPserver;
+
+        // 邮箱账号和密码(授权密码)
+        String userName = postAccount;
+        String password = postPassword;
+
+        // SMTP服务器的连接信息
+        Properties props = new Properties();
+        props.put("mail.smtp.host", smtp); // SMTP主机号
+        props.put("mail.smtp.port", post); // 主机端口号
+        props.put("mail.smtp.auth", "true"); // 是否需要认证
+        props.put("mail.smtp.starttls.enable", "true"); // 启用TLS加密
+        props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
+
+        // 创建Session
+        // 参数1:SMTP服务器的连接信息
+        // 参数2:用户认证对象(Authenticator接口的匿名实现类)
+        Session session = Session.getInstance(props, new Authenticator() {
+            @Override
+            protected PasswordAuthentication getPasswordAuthentication() {
+                return new PasswordAuthentication(userName, password);
+            }
+        });
+
+        // 开启调试模式
+        session.setDebug(true);
+
+        return session;
+    }
+}

+ 3 - 2
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/ServletUtils.java

@@ -24,8 +24,8 @@ public class ServletUtils
      */
     public static String getEncoded(String tag)
     {
-        String time = String.valueOf(System.currentTimeMillis()/1000);
-        return tag+Integer.valueOf(time.substring(1))+""+(((int)(Math.random() * 90 + 10)));
+        String time = String.valueOf(System.currentTimeMillis());
+        return tag+Long.valueOf(time.substring(1));
     }
     //导入生成编号使用
     public static String getImportEncoded(String tag)
@@ -78,6 +78,7 @@ public class ServletUtils
 
     }
 
+
     /**
      * 获取response
      */

+ 54 - 0
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/TelPhoneUtils.java

@@ -4,6 +4,9 @@ import com.zhongzheng.common.utils.spring.SpringUtils;
 import org.springframework.context.MessageSource;
 import org.springframework.context.i18n.LocaleContextHolder;
 
+import java.io.IOException;
+import java.util.Random;
+
 /**
  * 手机号码工具栏
  *
@@ -11,6 +14,57 @@ import org.springframework.context.i18n.LocaleContextHolder;
  */
 public class TelPhoneUtils
 {
+    //中国移动
+    public static final String[] CHINA_MOBILE = {
+            "134", "135", "136", "137", "138", "139", "150", "151", "152", "157", "158", "159",
+            "182", "183", "184", "187", "188", "178", "147", "172", "198"
+    };
+    //中国联通
+    public static final String[] CHINA_UNICOM = {
+            "130", "131", "132", "145", "155", "156", "166", "171", "175", "176", "185", "186", "166"
+    };
+    //中国电信
+    public static final String[] CHINA_TELECOME = {
+            "133", "149", "153", "173", "177", "180", "181", "189", "199"
+    };
+
+    /**
+     * 生成手机号
+     */
+    public static String createMobile() {
+        StringBuilder sb = new StringBuilder();
+        Random random = new Random();
+        int op = random.nextInt(3);//随机运营商标志位
+        String mobileThree;//手机号前三位
+        int temp;
+        switch (op) {
+            case 0:
+                mobileThree = CHINA_MOBILE[random.nextInt(CHINA_MOBILE.length)];
+                break;
+            case 1:
+                mobileThree = CHINA_UNICOM[random.nextInt(CHINA_UNICOM.length)];
+                break;
+            case 2:
+                mobileThree = CHINA_TELECOME[random.nextInt(CHINA_TELECOME.length)];
+                break;
+            default:
+                mobileThree = "op标志位有误!";
+                break;
+        }
+        if (mobileThree.length() > 3) {
+            return mobileThree;
+        }
+        sb.append(mobileThree);
+        //生成手机号后8位
+        for (int i = 0; i < 8; i++) {
+            temp = random.nextInt(10);
+            sb.append(temp);
+        }
+        return sb.toString();
+    }
+
+
+
     /**
      * 隐藏手机号码
      * @param tel

+ 233 - 4
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/ToolsUtils.java

@@ -1,5 +1,7 @@
 package com.zhongzheng.common.utils;
 
+
+import cn.hutool.core.convert.Convert;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
@@ -11,17 +13,30 @@ import com.zhongzheng.common.exception.CustomException;
 import io.micrometer.core.lang.NonNull;
 import net.sf.jsqlparser.expression.LongValue;
 
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.DESKeySpec;
+import javax.crypto.spec.DESedeKeySpec;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
 import java.awt.image.BufferedImage;
 import java.io.*;
 import java.nio.charset.StandardCharsets;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.*;
+
+
+import static org.apache.xmlbeans.impl.util.Base64.encode;
+
+
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
+
 public class ToolsUtils {
 
     public static final int EMU_PER_PX = 9525;
@@ -269,6 +284,11 @@ public class ToolsUtils {
         return null;
     }
 
+    public static String encodetoStr(byte[] src) {
+        byte[] encoded = encode(src);
+        return new String(encoded,0,0,encoded.length);
+    }
+
     /**
      * 不够位数的在前面补0,保留num的长度位数字
      * @param code
@@ -299,6 +319,17 @@ public class ToolsUtils {
         return true;
     }
 
+    public static Boolean checkOrderSignFromOldSys(String orderSn,String stamp,String sign) {
+        String newSign = orderSn+stamp+"pubilc2022";
+        if(!sign.equals(ToolsUtils.EncoderByMd5(newSign))){
+            return false;
+        }
+        if((Long.parseLong(stamp)+10L>(DateUtils.getNowTime().longValue()))&&(Long.parseLong(stamp)<(DateUtils.getNowTime().longValue()-10L))){
+            return false;
+        }
+        return true;
+    }
+
     public static Boolean checkSignCwSnFromOldSys(String cwSn,String stamp,String sign) {
         String newSign = cwSn+stamp+"pubilc2022";
         if(!sign.equals(ToolsUtils.EncoderByMd5(newSign))){
@@ -310,13 +341,45 @@ public class ToolsUtils {
         return true;
     }
 
+    public static String EncoderByMd5WithUtf(String str) {
+        String result = "";
+        MessageDigest md5 = null;
+        try {
+            md5 = MessageDigest.getInstance("MD5");
+            // 这句是关键
+            md5.update(str.getBytes("UTF-8"));
+        } catch (NoSuchAlgorithmException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (UnsupportedEncodingException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        byte b[] = md5.digest();
+        int i;
+        StringBuffer buf = new StringBuffer("");
+        for (int offset = 0; offset < b.length; offset++) {
+            i = b[offset];
+            if (i < 0)
+                i += 256;
+            if (i < 16)
+                buf.append("0");
+            buf.append(Integer.toHexString(i));
+        }
+        result = buf.toString();
+
+        return result;
+    }
+
+
+
     public static String EncoderByMd5(String str) {
         String result = "";
         MessageDigest md5 = null;
         try {
             md5 = MessageDigest.getInstance("MD5");
             // 这句是关键
-            md5.update(str.getBytes("gb2312"));
+            md5.update(str.getBytes("gbk"));
         } catch (NoSuchAlgorithmException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
@@ -340,6 +403,16 @@ public class ToolsUtils {
         return result;
     }
 
+    public static boolean verifEasyPwd(String passWord) {
+        if(Validator.isEmpty(passWord)){
+            return false;
+        }
+        if(passWord.length()<8||passWord.length()>16){
+            throw new CustomException("密码长度限制8到16位");
+        }
+        return true;
+    }
+
     public static boolean verifPwd(String passWord) {
         if(Validator.isEmpty(passWord)){
             return false;
@@ -353,14 +426,14 @@ public class ToolsUtils {
         if (m.matches()){
             return true;
         } else {
-            return false;
+            throw new CustomException("密码应由8-16位数字、大小写字母、符号组成");
         }
     }
 
     public static String getTenantId() {
-        String TenantId = ServletUtils.getRequest().getHeader("TenantId");
+        String TenantId =  ServletUtils.getResponse().getHeader("TenantId");
         if(!StrUtil.isNotBlank(TenantId)||TenantId==null){
-            TenantId = ServletUtils.getResponse().getHeader("TenantId");
+            TenantId = ServletUtils.getRequest().getHeader("TenantId");
         }
         if(Validator.isNotEmpty(TenantId)){
             if(TenantId.equals("undefined")){
@@ -424,4 +497,160 @@ public class ToolsUtils {
         return tmpImg ;
     }
 
+    public static String solve(String num) {
+        if (num == null) {
+            return null;
+        }
+        // 判断是否有小数
+        int index = num.indexOf(".");
+        if (index >= 0) {
+            String integer = num.substring(0, index);
+            String decimal = num.substring(index);
+            // 分隔后的整数+小数拼接起来
+            return addSeparator(integer) + decimal;
+        } else {
+            return addSeparator(num);
+        }
+    }
+
+    // 添加分隔符
+    public static String addSeparator(String num) {
+        int length = num.length();
+        ArrayList list = new ArrayList();
+        while (length > 3) {
+            list.add(num.substring(length - 3, length));
+            length = length - 3;
+        }
+        // 将前面小于三位的数字添加到ArrayList中
+        list.add(num.substring(0, length));
+        StringBuffer buffer = new StringBuffer();
+        // 倒序拼接
+        for (int i = list.size() - 1; i > 0; i--) {
+            buffer.append(list.get(i) + ",");
+        }
+        buffer.append(list.get(0));
+        return buffer.toString();
+    }
+
+    public static String dataSign(String sourceMsg, String pKey) throws NoSuchAlgorithmException {
+        String tempPKey = MD5PubHasher(pKey.getBytes(StandardCharsets.UTF_8));
+        tempPKey = sourceMsg + tempPKey;
+        tempPKey = MD5PubHasher(tempPKey.getBytes(StandardCharsets.UTF_8));
+        return tempPKey;
+    }
+
+    public static String MD5PubHasher(byte[] hashText)  {
+        try {
+            MessageDigest md5 = MessageDigest.getInstance("MD5");
+            byte[] b = md5.digest(hashText);
+            StringBuilder ret = new StringBuilder();
+            for (int i = 0; i < b.length; i++) {
+                ret.append(String.format("%02x", b[i]));
+            }
+            return ret.toString();
+        }catch (NoSuchAlgorithmException e){
+            return null;
+        }
+    }
+
+    public static String encryptDes(String source, byte[] key, byte[] iv) throws Exception {
+        SecretKey secretKey = new SecretKeySpec(key, "DES");
+        IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
+        Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
+        cipher.init(Cipher.ENCRYPT_MODE, secretKey, ivParameterSpec);
+        byte[] inputByteArray = source.getBytes(StandardCharsets.UTF_8);
+        byte[] encryptedByteArray = cipher.doFinal(inputByteArray);
+        return new String(java.util.Base64.getEncoder().encode(encryptedByteArray));
+    }
+
+    public static String decryptDes(String source, byte[] key, byte[] iv) throws Exception {
+        SecretKey secretKey = new SecretKeySpec(key, "DES");
+        IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
+        Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
+        cipher.init(Cipher.DECRYPT_MODE, secretKey, ivParameterSpec);
+        byte[] inputByteArray = java.util.Base64.getDecoder().decode(source.getBytes(StandardCharsets.UTF_8));
+        byte[] decryptedByteArray = cipher.doFinal(inputByteArray);
+        return new String(decryptedByteArray, StandardCharsets.UTF_8);
+    }
+
+    /*public static String encryptDesNew(String source, String pass) throws Exception {
+        byte[] rgbKey = pass.getBytes("UTF-8");
+        byte[] rgbIV = pass.getBytes("UTF-8");
+                DESedeKeySpec desKeySpec = new DESedeKeySpec(rgbKey);
+             SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
+             SecretKey secretKey = keyFactory.generateSecret(desKeySpec);
+             Cipher cipher = Cipher.getInstance("DESede/CBC/PKCS5Padding");
+            byte[] inputByteArray = source.getBytes("UTF-8");
+            IvParameterSpec ivParameterSpec = new IvParameterSpec(rgbIV);
+            cipher.init(Cipher.ENCRYPT_MODE, secretKey, ivParameterSpec);
+            byte[] encrypted = cipher.doFinal(inputByteArray);
+            return Base64.getEncoder().encodeToString(encrypted);}
+    }*/
+
+    /**
+
+     Des解密
+     @param source 源字符串
+     @param pass 密钥,长度必须8位
+     @return 解密后的字符串 */
+    /*public static String decryptDesNew(String source, String pass) throws Exception {
+        byte[] rgbKey = pass.getBytes("UTF-8");
+        byte[] rgbIV = pass.getBytes("UTF-8");
+        DESedeKeySpec desKeySpec = new DESedeKeySpec(rgbKey);
+        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
+        SecretKey secretKey = keyFactory.generateSecret(desKeySpec);
+        Cipher cipher = Cipher.getInstance("DESede/CBC/PKCS5Padding")) {
+        byte[] inputByteArray = Base64.getDecoder().decode(source);
+        IvParameterSpec ivParameterSpec = new IvParameterSpec(rgbIV);
+        cipher.init(Cipher.DECRYPT_MODE, secretKey, ivParameterSpec);
+        byte[] decrypted = cipher.doFinal(inputByteArray);
+        return new String(decrypted, "UTF-8");
+        }
+    }*/
+
+
+ public static String encryptDesNew(String source, String pass) throws Exception {
+        byte[] rgbKey = pass.getBytes(StandardCharsets.UTF_8);
+        byte[] rgbIV = pass.getBytes(StandardCharsets.UTF_8);
+        DESKeySpec desKeySpec = new DESKeySpec(rgbKey);
+        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
+        SecretKey secretKey = keyFactory.generateSecret(desKeySpec);
+        Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
+        byte[] inputByteArray = source.getBytes(StandardCharsets.UTF_8);
+        IvParameterSpec ivParameterSpec = new IvParameterSpec(rgbIV);
+        cipher.init(Cipher.ENCRYPT_MODE, secretKey, ivParameterSpec);
+        byte[] encryptedByteArray = cipher.doFinal(inputByteArray);
+        return Base64.getEncoder().encodeToString(encryptedByteArray);
+    }
+
+   public static String decryptDesNew(String source, String pass) throws Exception {
+        byte[] rgbKey = pass.getBytes(StandardCharsets.UTF_8);
+        byte[] rgbIV = pass.getBytes(StandardCharsets.UTF_8);
+        DESKeySpec desKeySpec = new DESKeySpec(rgbKey);
+        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
+        SecretKey secretKey = keyFactory.generateSecret(desKeySpec);
+        Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
+        byte[] inputByteArray = Base64.getDecoder().decode(source);
+        IvParameterSpec ivParameterSpec = new IvParameterSpec(rgbIV);
+        cipher.init(Cipher.DECRYPT_MODE, secretKey, ivParameterSpec);
+        byte[] decryptedByteArray = cipher.doFinal(inputByteArray);
+        return new String(decryptedByteArray, StandardCharsets.UTF_8);
+    }
+
+    private static String base64Encode(byte[] bytes) throws IOException {
+        ByteArrayOutputStream output = new ByteArrayOutputStream();
+        Base64.getEncoder().wrap(output).write(bytes);
+        return output.toString(StandardCharsets.UTF_8.name());
+    }
+
+    /*private static byte[] base64Decode(String str) throws IOException {
+        ByteArrayOutputStream output = new ByteArrayOutputStream();
+        Base64.getDecoder().wrap(output).write(str.getBytes(StandardCharsets.UTF_8));
+        return output.toByteArray();
+    }*/
+    private static byte[] base64Decode(String str) throws IOException {
+        byte[] decodedString = Base64.getDecoder().decode(new String(str).getBytes("UTF-8"));
+        return decodedString;
+    }
+
 }

+ 138 - 0
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/bank/DCCryptor.java

@@ -0,0 +1,138 @@
+package com.zhongzheng.common.utils.bank;
+
+import org.bouncycastle.asn1.*;
+import org.bouncycastle.crypto.params.ECDomainParameters;
+import org.bouncycastle.crypto.params.ECPrivateKeyParameters;
+import org.bouncycastle.crypto.params.ECPublicKeyParameters;
+import org.bouncycastle.crypto.params.ParametersWithID;
+import org.bouncycastle.crypto.signers.SM2Signer;
+import org.bouncycastle.jce.ECNamedCurveTable;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.bouncycastle.jce.spec.ECParameterSpec;
+import org.bouncycastle.math.ec.ECPoint;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.io.ByteArrayInputStream;
+import java.math.BigInteger;
+import java.security.Security;
+import java.util.Enumeration;
+
+/**
+ * 示例代码,仅供参考
+ */
+public class DCCryptor {
+
+    static {
+        Security.addProvider(new BouncyCastleProvider());
+    }
+
+    public static byte[] CMBSM4EncryptWithCBC(byte key[], byte iv[], byte input[]) throws Exception {
+        if (key == null || iv == null || input == null) {
+            throw new Exception("CMBSM4EncryptWithCBC 非法输入");
+        }
+        return CMBSM4Crypt(key, iv, input, 1);
+    }
+
+    public static byte[] CMBSM4DecryptWithCBC(byte key[], byte iv[], byte input[]) throws Exception {
+        if (key == null || iv == null || input == null) {
+            throw new Exception("CMBSM4DecryptWithCBC 非法输入");
+        }
+        return CMBSM4Crypt(key, iv, input, 2);
+    }
+
+    public static byte[] CMBSM2SignWithSM3(byte[] id, byte privkey[], byte msg[]) throws Exception {
+        if (privkey == null || msg == null) {
+            throw new Exception("CMBSM2SignWithSM3 input error");
+        }
+        ECPrivateKeyParameters privateKey = encodePrivateKey(privkey);
+        SM2Signer signer = new SM2Signer();
+        ParametersWithID parameters = new ParametersWithID(privateKey, id);
+        signer.init(true, parameters);
+        signer.update(msg, 0, msg.length);
+        return decodeDERSignature(signer.generateSignature());
+    }
+
+    public static boolean CMBSM2VerifyWithSM3(byte[] id, byte pubkey[], byte msg[], byte signature[]) throws Exception {
+
+        if (pubkey == null || msg == null || signature == null) {
+            throw new Exception("CMBSM2VerifyWithSM3 input error");
+        }
+        ECPublicKeyParameters publicKey = encodePublicKey(pubkey);
+        SM2Signer signer = new SM2Signer();
+        ParametersWithID parameters = new ParametersWithID(publicKey, id);
+        signer.init(false, parameters);
+        signer.update(msg, 0, msg.length);
+        return signer.verifySignature(encodeDERSignature(signature));
+    }
+
+    private static byte[] CMBSM4Crypt(byte key[], byte iv[], byte input[], int mode) throws Exception {
+        SecretKeySpec spec = new SecretKeySpec(key, "SM4");
+        IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
+        Cipher cipher = Cipher.getInstance("SM4/CBC/PKCS7Padding", BouncyCastleProvider.PROVIDER_NAME);
+        cipher.init(mode, spec, ivParameterSpec);
+        return cipher.doFinal(input);
+    }
+
+    private static ECPrivateKeyParameters encodePrivateKey(byte[] value) {
+        BigInteger d = new BigInteger(1, value);
+        ECParameterSpec spec = ECNamedCurveTable.getParameterSpec("sm2p256v1");
+        ECDomainParameters ecParameters = new ECDomainParameters(spec.getCurve(), spec.getG(), spec.getN(), spec.getH(), spec.getSeed());
+        return new ECPrivateKeyParameters(d, ecParameters);
+    }
+
+    public static ECPublicKeyParameters encodePublicKey(byte[] value) {
+        byte[] x = new byte[32];
+        byte[] y = new byte[32];
+        System.arraycopy(value, 1, x, 0, 32);
+        System.arraycopy(value, 33, y, 0, 32);
+        BigInteger X = new BigInteger(1, x);
+        BigInteger Y = new BigInteger(1, y);
+        ECParameterSpec spec = ECNamedCurveTable.getParameterSpec("sm2p256v1");
+        ECPoint Q = spec.getCurve().createPoint(X, Y);
+        ECDomainParameters ecParameters = new ECDomainParameters(spec.getCurve(), spec.getG(), spec.getN(), spec.getH(), spec.getSeed());
+        return new ECPublicKeyParameters(Q, ecParameters);
+    }
+
+    @SuppressWarnings("unchecked")
+    private static byte[] decodeDERSignature(byte[] signature) throws Exception {
+        ASN1InputStream stream = new ASN1InputStream(new ByteArrayInputStream(signature));
+        ASN1Sequence primitive = (ASN1Sequence) stream.readObject();
+        Enumeration<ASN1Integer> enumeration = primitive.getObjects();
+        BigInteger R = enumeration.nextElement().getValue();
+        BigInteger S = enumeration.nextElement().getValue();
+        byte[] bytes = new byte[64];
+        byte[] r = format(R.toByteArray());
+        byte[] s = format(S.toByteArray());
+        System.arraycopy(r, 0, bytes, 0, 32);
+        System.arraycopy(s, 0, bytes, 32, 32);
+        return bytes;
+    }
+
+    private static byte[] encodeDERSignature(byte[] signature) throws Exception {
+        byte[] r = new byte[32];
+        byte[] s = new byte[32];
+        System.arraycopy(signature, 0, r, 0, 32);
+        System.arraycopy(signature, 32, s, 0, 32);
+        ASN1EncodableVector vector = new ASN1EncodableVector();
+        vector.add(new ASN1Integer(new BigInteger(1, r)));
+        vector.add(new ASN1Integer(new BigInteger(1, s)));
+        return (new DERSequence(vector)).getEncoded();
+    }
+
+    private static byte[] format(byte[] value) {
+        if (value.length == 32) {
+            return value;
+        } else {
+            byte[] bytes = new byte[32];
+            if (value.length > 32) {
+                System.arraycopy(value, value.length - 32, bytes, 0, 32);
+            } else {
+                System.arraycopy(value, 0, bytes, 32 - value.length, value.length);
+            }
+            return bytes;
+        }
+    }
+
+}

+ 169 - 0
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/bank/DCHelper.java

@@ -0,0 +1,169 @@
+package com.zhongzheng.common.utils.bank;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+
+import javax.net.ssl.*;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.security.KeyStore;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * 示例代码,仅供参考
+ * 本示例中用到的(HttpUrlConnection)存在不遵循RFC协议的重试机制,请在启动参数中将sun.net.http.retryPost参数设置为false,禁用重发。
+ */
+public class DCHelper {
+
+    public static String serialJsonOrdered(JsonObject json) throws Exception {
+        StringBuilder appender = new StringBuilder();
+        appender.append("{");
+        Iterator<String> keys = new TreeSet<>(json.keySet()).iterator();
+        boolean isFirstEle = true;
+        while (keys.hasNext()) {
+            if (!isFirstEle) {
+                appender.append(",");
+            }
+            String key = keys.next();
+            Object val = json.get(key);
+            if (val instanceof JsonObject) {
+                appender.append("\"").append(key).append("\":");
+                appender.append(serialJsonOrdered((JsonObject) val));
+            } else if (val instanceof JsonArray) {
+                JsonArray jarray = (JsonArray) val;
+                appender.append("\"").append(key).append("\":[");
+                boolean isFirstArrEle = true;
+                for (int i = 0; i < jarray.size(); i++) {
+                    if (!isFirstArrEle) {
+                        appender.append(",");
+                    }
+                    Object obj = jarray.get(i);
+                    if (obj instanceof JsonObject) {
+                        appender.append(serialJsonOrdered((JsonObject) obj));
+                    } else {
+                        appender.append(obj.toString());
+                    }
+                    isFirstArrEle = false;
+                }
+                appender.append("]");
+            } else {
+                String value = val.toString();
+                appender.append("\"").append(key).append("\":").append(value);
+            }
+            isFirstEle = false;
+        }
+        appender.append("}");
+        return appender.toString();
+    }
+
+    public static String getTime() {
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
+        return dateFormat.format(new Date());
+    }
+
+    public static String doPostForm(String httpUrl, Map<String, String> param) throws Exception {
+        HttpURLConnection connection = null;
+        InputStream is = null;
+        OutputStream os = null;
+        BufferedReader br = null;
+        String result = null;
+        try {
+            URL url = new URL(httpUrl);
+            SSLContext sslcontext;
+            sslcontext = SSLContext.getInstance("SSL");
+            TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+            tmf.init((KeyStore) null);
+            X509TrustManager defaultTm = null;
+            for (TrustManager tm : tmf.getTrustManagers()) {
+                if (tm instanceof X509TrustManager) {
+                    defaultTm = (X509TrustManager) tm;
+                    break;
+                }
+            }
+            sslcontext.init(null, new TrustManager[] { defaultTm }, new java.security.SecureRandom());
+            HttpsURLConnection.setDefaultSSLSocketFactory(sslcontext.getSocketFactory());
+
+            connection = (HttpURLConnection) url.openConnection();
+            connection.setRequestMethod("POST");
+            connection.setConnectTimeout(15000);
+            connection.setReadTimeout(60000);
+            connection.setInstanceFollowRedirects(true);
+
+            connection.setDoOutput(true);
+            connection.setDoInput(true);
+
+            connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
+            os = connection.getOutputStream();
+            os.write(createLinkString(param).getBytes());
+            if (connection.getResponseCode() != 200) {
+                is = connection.getErrorStream();
+                br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+                StringBuilder sbf = new StringBuilder();
+                String temp = null;
+                while ((temp = br.readLine()) != null) {
+                    sbf.append(temp);
+                    sbf.append("\r\n");
+                }
+                result = sbf.toString();
+            } else {
+                is = connection.getInputStream();
+                br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+                StringBuilder sbf = new StringBuilder();
+                String temp = null;
+                boolean firstLine = true;
+                while ((temp = br.readLine()) != null) {
+                    if (!firstLine) {
+                        firstLine = false;
+                        sbf.append("\r\n");
+                    }
+                    sbf.append(temp);
+                }
+                result = sbf.toString();
+            }
+        } finally {
+            if (null != br) {
+                try {
+                    br.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (null != os) {
+                try {
+                    os.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (null != is) {
+                try {
+                    is.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            connection.disconnect();
+        }
+        return result;
+    }
+
+    private static String createLinkString(Map<String, String> params) throws Exception {
+        ArrayList<String> keys = new ArrayList<>(params.keySet());
+        Collections.sort(keys);
+
+        StringBuilder prestr = new StringBuilder();
+        for (int i = 0; i < keys.size(); i++) {
+            String key = keys.get(i);
+            String value = params.get(key);
+            if (i == keys.size() - 1) {
+                prestr.append(key).append("=").append(value);
+            } else {
+                prestr.append(key).append("=").append(value).append("&");
+            }
+        }
+        return prestr.toString();
+    }
+
+}

+ 61 - 0
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/bank/GENKey.java

@@ -0,0 +1,61 @@
+package com.zhongzheng.common.utils.bank;
+
+import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
+import org.bouncycastle.crypto.params.ECDomainParameters;
+import org.bouncycastle.crypto.params.ECKeyGenerationParameters;
+import org.bouncycastle.crypto.params.ECPrivateKeyParameters;
+import org.bouncycastle.crypto.params.ECPublicKeyParameters;
+import org.bouncycastle.jce.ECNamedCurveTable;
+import org.bouncycastle.jce.spec.ECParameterSpec;
+import org.bouncycastle.crypto.generators.ECKeyPairGenerator;
+
+import java.math.BigInteger;
+import java.security.SecureRandom;
+import java.util.Base64;
+import java.util.HashMap;
+import java.util.Map;
+
+
+
+
+public class GENKey {
+
+    private static ECDomainParameters getECDomainParameters() {
+        ECParameterSpec spec = ECNamedCurveTable.getParameterSpec("sm2p256v1");
+        return new ECDomainParameters(spec.getCurve(), spec.getG(), spec.getN(), spec.getH(), spec.getSeed());
+    }
+
+
+    /**
+     * 生成国密密钥对
+     *
+     * @return
+     */
+    public static Map<String, byte[]> CMBSM2KeyGen() {
+        ECDomainParameters domainParameters = getECDomainParameters();
+        ECKeyPairGenerator generator = new ECKeyPairGenerator();
+        ECKeyGenerationParameters parameters = new ECKeyGenerationParameters(domainParameters, new SecureRandom());
+        generator.init(parameters);
+        AsymmetricCipherKeyPair keyPair = generator.generateKeyPair();
+        ECPublicKeyParameters publicKeyParameters = (ECPublicKeyParameters) keyPair.getPublic();
+        ECPrivateKeyParameters privateKeyParameters = (ECPrivateKeyParameters) keyPair.getPrivate();
+        Map<String, byte[]> map = new HashMap<>();
+        map.put("publickey", publicKeyParameters.getQ().getEncoded(false));
+        map.put("privatekey", format(privateKeyParameters.getD().toByteArray()));
+        return map;
+    }
+
+    private static byte[] format(byte[] value) {
+        if (value.length == 32) {
+            return value;
+        }
+        byte bytes[] = new byte[32];
+        if (value.length > 32) {
+            System.arraycopy(value, value.length - 32, bytes, 0, 32);
+        } else {
+            System.arraycopy(value, 0, bytes, 32 - value.length, value.length);
+        }
+        return bytes;
+    }
+
+}

+ 271 - 6
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/file/FileUtils.java

@@ -7,6 +7,7 @@ import com.zhongzheng.common.exception.CustomException;
 import org.apache.commons.fileupload.FileItem;
 import org.apache.commons.fileupload.disk.DiskFileItemFactory;
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.http.MediaType;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.commons.CommonsMultipartFile;
@@ -16,15 +17,19 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.*;
 import java.math.BigInteger;
 import java.net.URLEncoder;
+import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.security.MessageDigest;
 import java.util.Comparator;
-import java.util.Formatter;
+import java.util.List;
 import java.util.UUID;
 import java.util.stream.Stream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
 
 /**
  * 文件处理工具类
@@ -33,6 +38,8 @@ import java.util.stream.Stream;
  */
 public class FileUtils extends org.apache.commons.io.FileUtils
 {
+
+    private static final byte[] buf = new byte[1024];
     public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";
 
     /**
@@ -279,11 +286,8 @@ public class FileUtils extends org.apache.commons.io.FileUtils
             fis.close();
             //转换并返回包含16个元素字节数组,返回数值范围为-128到127
             byte[] md5Bytes = md.digest();
-            Formatter formatter = new Formatter();
-            for (byte md5Byte : md5Bytes) {
-                formatter.format("%02x", md5Byte);
-            }
-            return formatter.toString();
+            BigInteger bigInt = new BigInteger(1, md5Bytes);
+            return bigInt.toString(16);
         } catch (Exception e) {
             e.printStackTrace();
             return "";
@@ -301,4 +305,265 @@ public class FileUtils extends org.apache.commons.io.FileUtils
             throw new CustomException(e.getMessage());
         }
     }
+
+    /**
+     * 压缩成ZIP 方法1
+     *
+     * @param zipFileName       压缩文件夹路径
+     * @param sourceFileName    要压缩的文件路径
+     * @param KeepDirStructure 是否保留原来的目录结构,true:保留目录结构;
+     *                         false:所有文件跑到压缩包根目录下(注意:不保留目录结构可能会出现同名文件,会压缩失败)
+     * @throws RuntimeException 压缩失败会抛出运行时异常
+     */
+    public static Boolean toZip(String zipFileName, String sourceFileName, boolean KeepDirStructure) {
+        Boolean result = true;
+        long start = System.currentTimeMillis();//开始
+        ZipOutputStream zos = null;
+        try {
+            FileOutputStream fileOutputStream = new FileOutputStream(zipFileName);
+            zos = new ZipOutputStream(fileOutputStream);
+            File sourceFile = new File(sourceFileName);
+            compress(sourceFile, zos, sourceFile.getName(), KeepDirStructure);
+            long end = System.currentTimeMillis();//结束
+            System.out.println("压缩完成,耗时:" + (end - start) + " 毫秒");
+        } catch (Exception e) {
+            result = false;
+            e.printStackTrace();
+        } finally {
+            if (zos != null) {
+                try {
+                    zos.close();
+                } catch (IOException e) {
+                    e.getStackTrace();
+                }
+            }
+        }
+        return result;
+    }
+
+    /**
+     * @Title: compress
+     * @Description: TODO
+     * @param filePaths 需要压缩的文件地址列表(绝对路径)
+     * @param zipFilePath 需要压缩到哪个zip文件(无需创建这样一个zip,只需要指定一个全路径)
+     * @param keepDirStructure 压缩后目录是否保持原目录结构
+     * @throws IOException
+     * @return int   压缩成功的文件个数
+     */
+    public static Boolean compressList(List<String> filePaths, String zipFilePath, Boolean keepDirStructure){
+        byte[] buf = new byte[1024];
+        File zipFile = new File(zipFilePath);
+        int fileCount = 0;//记录压缩了几个文件?
+        try {
+            //zip文件不存在,则创建文件,用于压缩
+            if(!zipFile.exists()){
+                zipFile.createNewFile();
+            }
+            ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile));
+            for(int i = 0; i < filePaths.size(); i++){
+                String relativePath = filePaths.get(i);
+                if(StringUtils.isEmpty(relativePath)){
+                    continue;
+                }
+                File sourceFile = new File(relativePath);//绝对路径找到file
+                if(sourceFile == null || !sourceFile.exists()){
+                    continue;
+                }
+
+                FileInputStream fis = new FileInputStream(sourceFile);
+                if(keepDirStructure!=null && keepDirStructure){
+                    //保持目录结构
+                    zos.putNextEntry(new ZipEntry(relativePath));
+                }else{
+                    //直接放到压缩包的根目录
+                    zos.putNextEntry(new ZipEntry(sourceFile.getName()));
+                }
+                //System.out.println("压缩当前文件:"+sourceFile.getName());
+                int len;
+                while((len = fis.read(buf)) > 0){
+                    zos.write(buf, 0, len);
+                }
+                zos.closeEntry();
+                fis.close();
+                fileCount++;
+            }
+            zos.close();
+            //System.out.println("压缩完成");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return fileCount > 0;
+    }
+
+
+    /**
+     * 递归压缩方法
+     *
+     * @param sourceFile       源文件
+     * @param zos              zip输出流
+     * @param name             压缩后的名称
+     * @param KeepDirStructure 是否保留原来的目录结构,true:保留目录结构;
+     *                         false:所有文件跑到压缩包根目录下(注意:不保留目录结构可能会出现同名文件,会压缩失败)
+     * @throws Exception
+     */
+    public static void compress(File sourceFile, ZipOutputStream zos, String name,
+                                boolean KeepDirStructure) throws Exception {
+
+        if (sourceFile.isFile()) {
+            // 向zip输出流中添加一个zip实体,构造器中name为zip实体的文件的名字
+            zos.putNextEntry(new ZipEntry(name));
+            // copy文件到zip输出流中
+            int len;
+            FileInputStream in = new FileInputStream(sourceFile);
+            while ((len = in.read(buf)) != -1) {
+                zos.write(buf, 0, len);
+            }
+            // Complete the entry
+            zos.closeEntry();
+            in.close();
+        } else {
+            File[] listFiles = sourceFile.listFiles();
+            if (listFiles == null || listFiles.length == 0) {
+                // 需要保留原来的文件结构时,需要对空文件夹进行处理
+                if (KeepDirStructure) {
+                    // 空文件夹的处理
+                    zos.putNextEntry(new ZipEntry(name + "/"));
+                    // 没有文件,不需要文件的copy
+                    zos.closeEntry();
+                }
+            } else {
+                for (File file : listFiles) {
+                    // 判断是否需要保留原来的文件结构
+                    if (KeepDirStructure) {
+                        // 注意:file.getName()前面需要带上父文件夹的名字加一斜杠,
+                        // 不然最后压缩包中就不能保留原来的文件结构,即:所有文件都跑到压缩包根目录下了
+                        compress(file, zos, name + "/" + file.getName(), KeepDirStructure);
+                    } else {
+                        compress(file, zos, file.getName(), KeepDirStructure);
+                    }
+                }
+            }
+        }
+    }
+
+
+    /**
+     * 解压
+     *
+     * @param inputStream zip压缩文件
+     * @param descDir 指定的解压目录
+     */
+    public static void unzipWithStream(InputStream inputStream, String descDir) {
+        if (!descDir.endsWith(File.separator)) {
+            descDir = descDir + File.separator;
+        }
+        try (ZipInputStream zipInputStream = new ZipInputStream(inputStream, Charset.forName("GBK"))) {
+            ZipEntry zipEntry;
+            while ((zipEntry = zipInputStream.getNextEntry()) != null) {
+                String zipEntryNameStr = zipEntry.getName();
+                String zipEntryName = zipEntryNameStr;
+                if (zipEntryNameStr.contains("/")) {
+                    String str1 = zipEntryNameStr.substring(0, zipEntryNameStr.indexOf("/"));
+                    zipEntryName = zipEntryNameStr.substring(str1.length() + 1);
+                }
+                String outPath = (descDir + zipEntryName).replace("\\\\", "/");
+                File outFile = new File(outPath.substring(0, outPath.lastIndexOf('/')));
+                if (!outFile.exists()) {
+                    outFile.mkdirs();
+                }
+                if (new File(outPath).isDirectory()) {
+                    continue;
+                }
+                writeFile(outPath, zipInputStream);
+                zipInputStream.closeEntry();
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new CustomException("压缩包处理异常,异常信息{}"+ e);
+        }
+    }
+
+    //将流写到文件中
+    public static void writeFile(String filePath, ZipInputStream zipInputStream) {
+        File file = new File(filePath);
+        File directory = file.getParentFile();
+        if (!directory.exists()){
+            directory.mkdirs();
+        }
+        try (OutputStream outputStream = new FileOutputStream(filePath)) {
+            byte[] bytes = new byte[4096];
+            int len;
+            while ((len = zipInputStream.read(bytes)) != -1) {
+                outputStream.write(bytes, 0, len);
+            }
+        } catch (IOException ex) {
+            ex.printStackTrace();
+            throw new CustomException("解压文件时,写出到文件出错!");
+        }
+    }
+
+
+    /**
+     * 打包压缩文件夹
+     *
+     * @param folderPath 文件夹路径
+     * @param zipFilePath 压缩后的文件路径
+     * @throws IOException IO异常
+     */
+    public static void zipFolder(String folderPath, String zipFilePath) throws IOException {
+        FileOutputStream fos = null;
+        ZipOutputStream zos = null;
+        try {
+            fos = new FileOutputStream(zipFilePath);
+            zos = new ZipOutputStream(fos);
+
+            // 递归遍历整个文件夹并添加到压缩包
+            addFolderToZip("", new File(folderPath), zos);
+        } finally {
+            if (zos != null) {
+                zos.close();
+            }
+            if (fos != null) {
+                fos.close();
+            }
+        }
+    }
+
+    /**
+     * 将文件夹及其中的文件递归添加到压缩流中
+     *
+     * @param parentPath 父级路径
+     * @param folder 文件夹
+     * @param zos Zip输出流
+     * @throws FileNotFoundException 文件未找到异常
+     * @throws IOException IO异常
+     */
+    private static void addFolderToZip(String parentPath, File folder, ZipOutputStream zos) throws FileNotFoundException, IOException {
+        for (File file : folder.listFiles()) {
+            if (file.isDirectory()) {
+                // 递归添加子文件夹中的文件
+                addFolderToZip(parentPath + folder.getName() + "/", file, zos);
+            } else {
+                FileInputStream fis = null;
+                try {
+                    fis = new FileInputStream(file);
+
+                    // 新建Zip条目并将输入流加入到Zip包中
+                    ZipEntry zipEntry = new ZipEntry( folder.getName() + "/" + file.getName());
+                    zos.putNextEntry(zipEntry);
+
+                    byte[] bytes = new byte[1024];
+                    int length;
+                    while ((length = fis.read(bytes)) >= 0) {
+                        zos.write(bytes, 0, length);
+                    }
+                } finally {
+                    if (fis != null) {
+                        fis.close();
+                    }
+                }
+            }
+        }
+    }
+
 }

+ 20 - 0
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/file/ImageUtils.java

@@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory;
 import sun.misc.BASE64Encoder;
 
 import javax.imageio.ImageIO;
+import java.awt.*;
 import java.awt.image.BufferedImage;
 import java.io.*;
 import java.net.URL;
@@ -106,4 +107,23 @@ public class ImageUtils
         return s;
 
     }
+
+    /** * 旋转图片为指定角度  图片宽高不变*
+     * @param bufferedimage * 目标图像 *
+     * @param degree * 旋转角度 *
+     * @return */
+    public static BufferedImage rotateImage(final BufferedImage bufferedimage, final int degree)
+    {
+        int w= bufferedimage.getWidth(); // 得到图片宽度。
+        int h= bufferedimage.getHeight();// 得到图片高度。
+        int type= bufferedimage.getColorModel().getTransparency();// 得到图片透明度。
+        BufferedImage img;// 空的图片。
+        Graphics2D graphics2d;// 空的画笔。
+        (graphics2d= (img= new BufferedImage(w, h, type)).createGraphics()).setRenderingHint( RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
+        graphics2d.rotate(Math.toRadians(degree), w/2, h/2);// 旋转,degree是整型,度数,比如垂直90度。   •rotate(double arc,double x, double y):图形以点(x,y)为轴点,旋转arc弧度。
+        graphics2d.drawImage(bufferedimage, 0, 0, null);// 从bufferedimagecopy图片至img,0,0是img的坐标。
+        graphics2d.dispose();
+
+        return img;// 返回复制好的图片,原图片依然没有变,没有旋转,下次还可以使用。
+    }
 }

+ 107 - 31
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/http/HttpUtils.java

@@ -1,6 +1,7 @@
 package com.zhongzheng.common.utils.http;
 
 import cn.hutool.core.lang.Validator;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import org.apache.http.*;
 import org.apache.http.client.HttpClient;
@@ -9,6 +10,8 @@ import org.apache.http.client.entity.UrlEncodedFormEntity;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClientBuilder;
@@ -21,6 +24,8 @@ import org.slf4j.LoggerFactory;
 import javax.net.ssl.*;
 import java.io.*;
 import java.net.*;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
 import java.security.cert.X509Certificate;
 import java.util.*;
 
@@ -112,7 +117,22 @@ public class HttpUtils
         return result.toString();
     }
     public static String postFormBody(String url, Map<String, String> paramMap) throws IOException{
-        return post(url, paramMap, null);
+        try{
+            String result = post(url, paramMap, null);
+            return result;
+        }catch (Exception e){
+            return null;
+        }
+
+    }
+
+    public static String postFormBodyHeader(String url, Map<String, String> paramMap, Map<String, String> headersMap) throws IOException{
+        try{
+            String result = postHead(url, paramMap, null,headersMap);
+            return result;
+        }catch (Exception e){
+            return null;
+        }
 
     }
 
@@ -157,6 +177,7 @@ public class HttpUtils
 
     public static String sendPostJsonHeader(String url, String json, Map<String, String> headersMap)
     {
+   //     System.out.println(json);
         HttpClient client = HttpClients.createDefault();
         HttpPost post = new HttpPost(url);
         try {
@@ -195,6 +216,28 @@ public class HttpUtils
         return null;
     }
 
+    public static String sendPostJsonHeaderAsync(String url, String json, Map<String, String> headersMap)
+    {
+        RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(5*1000).setConnectTimeout(5*1000).build();
+        HttpClient client =  HttpClients.createDefault();
+        HttpPost post = new HttpPost(url);
+        post.setConfig(requestConfig);
+        try {
+            //此处应设定参数的编码格式,不然中文会变乱码
+            StringEntity s = new StringEntity(json, "UTF-8");
+            s.setContentEncoding("UTF-8");
+            s.setContentType("application/json");
+            post.setEntity(s);
+            post.addHeader("content-type", "application/json");
+            headersMap.forEach(post::setHeader);
+            client.execute(post);
+        } catch (Exception e) {
+            e.printStackTrace();
+//            throw new RuntimeException(e);
+        }
+        return null;
+    }
+
     public static String sendPostHeader(String url, JSONObject param, Map<String, String> headersMap)
     {
         HttpClient client = HttpClients.createDefault();
@@ -235,29 +278,6 @@ public class HttpUtils
         return null;
     }
 
-
-    public static String sendPostJsonHeaderAsync(String url, String json, Map<String, String> headersMap)
-    {
-        RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(5*1000).setConnectTimeout(5*1000).build();
-        HttpClient client =  HttpClients.createDefault();
-        HttpPost post = new HttpPost(url);
-        post.setConfig(requestConfig);
-        try {
-            //此处应设定参数的编码格式,不然中文会变乱码
-            StringEntity s = new StringEntity(json, "UTF-8");
-            s.setContentEncoding("UTF-8");
-            s.setContentType("application/json");
-            post.setEntity(s);
-            post.addHeader("content-type", "application/json");
-            headersMap.forEach(post::setHeader);
-            client.execute(post);
-        } catch (Exception e) {
-            e.printStackTrace();
-            throw new RuntimeException(e);
-        }
-        return null;
-    }
-
     /**
      * 向指定 URL 发送POST方法的请求
      *
@@ -281,7 +301,7 @@ public class HttpUtils
             conn.setRequestProperty("connection", "Keep-Alive");
             conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
             conn.setRequestProperty("Accept-Charset", "utf-8");
-            conn.setRequestProperty("contentType", "utf-8");
+            conn.setRequestProperty("contentType", "application/json;charset=UTF-8");
             conn.setDoOutput(true);
             conn.setDoInput(true);
             out = new PrintWriter(conn.getOutputStream());
@@ -463,6 +483,41 @@ public class HttpUtils
         return url;
     }
 
+    private static String postHead(String url, Map<String, String> paramMap, String encoding, Map<String, String> headersMap) throws IOException, NoSuchAlgorithmException, KeyManagementException {
+        log.debug("http 请求 url: {} , 请求参数: {}", url, appendUrl("", paramMap).replace("?", ""));
+        encoding = encoding == null ? UTF8 : encoding;
+        // 创建post方式请求对象
+        HttpPost httpPost = new HttpPost(url);
+        // 装填参数
+        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
+        if (paramMap != null) {
+            for (Map.Entry<String, String> entry : paramMap.entrySet()) {
+                String value = entry.getValue();
+                //去掉如下判断会造成String类型的value为null时
+                if (value != null) {
+                    nameValuePairs.add(new BasicNameValuePair(entry.getKey(), value));
+                }
+            }
+        }
+        // 设置参数到请求对象中
+        httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, encoding));
+        // 设置header信息
+        // 指定报文头【Content-type】、【User-Agent】
+        httpPost.setHeader("Content-type", APPLICATION_FORM_URLENCODED);
+        headersMap.forEach(httpPost::setHeader);
+        return post(url, httpPost, encoding, new DataParse<String>() {
+            @Override
+            public String parseData(HttpEntity httpEntity, String encoding) throws IOException {
+                if(Validator.isNotEmpty(httpEntity)){
+                    return EntityUtils.toString(httpEntity, encoding);
+                }else{
+                    return null;
+                }
+
+            }
+        });
+    }
+
     /**
      * 向url发送post请求表单提交数据
      * @param url 请求url
@@ -471,7 +526,7 @@ public class HttpUtils
      * @return 请求返回的数据
      * @throws IOException 读写异常
      */
-    private static String post(String url, Map<String, String> paramMap, String encoding) throws IOException {
+    private static String post(String url, Map<String, String> paramMap, String encoding) throws IOException, NoSuchAlgorithmException, KeyManagementException {
         log.debug("http 请求 url: {} , 请求参数: {}", url, appendUrl("", paramMap).replace("?", ""));
         encoding = encoding == null ? UTF8 : encoding;
         // 创建post方式请求对象
@@ -513,11 +568,28 @@ public class HttpUtils
      * @throws IOException 读写异常
      */
     private static <T> T post(String url, HttpPost httpPost, String encoding, DataParse<T> dataParse)
-            throws IOException {
+            throws IOException, NoSuchAlgorithmException, KeyManagementException {
+        TrustManager[] trustAllCerts = new TrustManager[] {
+                new X509TrustManager() {
+                    public X509Certificate[] getAcceptedIssuers() {
+                        return null;
+                    }
+                    public void checkClientTrusted(X509Certificate[] certs, String authType) {
+                        // don't check
+                    }
+                    public void checkServerTrusted(X509Certificate[] certs, String authType) {
+                        // don't check
+                    }
+                }
+        };
+
+        SSLContext ctx = SSLContext.getInstance("TLS");
+        ctx.init(null, trustAllCerts, null);
+        LayeredConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(ctx);
         T result = null;
         CloseableHttpResponse response = null;
         // 创建httpclient对象
-        CloseableHttpClient httpClient = HttpClientBuilder.create().build();
+        CloseableHttpClient httpClient = HttpClientBuilder.create().setSSLSocketFactory(sslSocketFactory).build();
 
         // 执行请求操作,并拿到结果(同步阻塞)
         response = sendRequestAndGetResult(url, httpClient, httpPost);
@@ -600,8 +672,12 @@ public class HttpUtils
     }
 
     public static String postFormBodyHeader(String url, Map<String, String> paramMap, Map<String, String> headersMap, Header[] header) throws IOException{
-        return postHearder(url, paramMap, null, headersMap, header);
-
+        try{
+            String result = postHearder(url, paramMap, null, headersMap, header);
+            return result;
+        }catch (Exception e){
+            return null;
+        }
     }
 
     /**
@@ -613,7 +689,7 @@ public class HttpUtils
      * @return 请求返回的数据
      * @throws IOException 读写异常
      */
-    private static String postHearder(String url, Map<String, String> paramMap, String encoding, Map<String, String> headersMap, Header[] header) throws IOException {
+    private static String postHearder(String url, Map<String, String> paramMap, String encoding, Map<String, String> headersMap, Header[] header) throws IOException, NoSuchAlgorithmException, KeyManagementException {
         log.debug("http 请求 url: {} , 请求参数: {}", url, appendUrl("", paramMap).replace("?", ""));
         encoding = encoding == null ? UTF8 : encoding;
         // 创建post方式请求对象

+ 319 - 1
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/poi/ExcelUtil.java

@@ -30,7 +30,6 @@ import java.io.*;
 import java.lang.reflect.Field;
 import java.math.BigDecimal;
 import java.text.DecimalFormat;
-import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -316,6 +315,216 @@ public class ExcelUtil<T>
         return list;
     }
 
+    /**
+     * 获取七大员指定表格考试时间
+     *
+     * @param is 输入流
+     * @return 转换后集合
+     */
+    public String examApplyTimeAnalysis(InputStream is,Integer index) throws Exception
+    {
+        this.type = Type.IMPORT;
+        this.wb = WorkbookFactory.create(is);
+        Sheet sheet = wb.getSheetAt(0);
+        if (sheet == null)
+        {
+            throw new IOException("文件sheet不存在");
+        }
+        // 获取表头
+        Row heard = sheet.getRow(index);
+        Iterator<Cell> cellIterator = heard.cellIterator();
+        List<String> dataList = new ArrayList<>();
+        while(cellIterator.hasNext()) {
+            Cell next = cellIterator.next();
+            String stringCellValue = next.getStringCellValue();
+            dataList.add(stringCellValue);
+        }
+        return dataList.get(dataList.size() -1);
+    }
+    /**
+     * 七大员考试回执方法
+     *
+     * @param sheetName 表格索引名
+     * @param is 输入流
+     * @return 转换后集合
+     */
+    public List<T> examApplyImportExcel(String sheetName, InputStream is) throws Exception
+    {
+        this.type = Type.IMPORT;
+        this.wb = WorkbookFactory.create(is);
+        List<T> list = new ArrayList<T>();
+        Sheet sheet = null;
+        if (Validator.isNotEmpty(sheetName))
+        {
+            // 如果指定sheet名,则取指定sheet中的内容.
+            sheet = wb.getSheet(sheetName);
+        }
+        else
+        {
+            // 如果传入的sheet名不存在则默认指向第1个sheet.
+            sheet = wb.getSheetAt(0);
+        }
+
+        if (sheet == null)
+        {
+            throw new IOException("文件sheet不存在");
+        }
+
+        int rows = sheet.getPhysicalNumberOfRows();
+
+        if (rows > 0)
+        {
+            // 定义一个map用于存放excel列的序号和field.
+            Map<String, Integer> cellMap = new HashMap<String, Integer>();
+            // 第2行是表头
+            Row heard = sheet.getRow(2);
+            for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++)
+            {
+                Cell cell = heard.getCell(i);
+                if (Validator.isNotNull(cell))
+                {
+                    String value = this.getCellValue(heard, i).toString();
+                    cellMap.put(value, i);
+                }
+                else
+                {
+                    cellMap.put(null, i);
+                }
+            }
+            // 有数据时才处理 得到类的所有field.
+            Field[] allFields = clazz.getDeclaredFields();
+            // 定义一个map用于存放列的序号和field.
+            Map<Integer, Field> fieldsMap = new HashMap<Integer, Field>();
+            for (int col = 0; col < allFields.length; col++)
+            {
+                Field field = allFields[col];
+                Excel attr = field.getAnnotation(Excel.class);
+                if (attr != null && (attr.type() == Type.ALL || attr.type() == type))
+                {
+                    // 设置类的私有字段属性可访问.
+                    field.setAccessible(true);
+                    Integer column = cellMap.get(attr.name());
+                    if (column != null)
+                    {
+                        fieldsMap.put(column, field);
+                    }
+                }
+            }
+            for (int i = 3; i < rows; i++)
+            {
+                // 从第3行开始取数据,第2行是表头.
+                Row row = sheet.getRow(i);
+                if(row == null)
+                {
+                    continue;
+                }
+                T entity = null;
+                for (Map.Entry<Integer, Field> entry : fieldsMap.entrySet())
+                {
+                    Object val = this.getCellValue(row, entry.getKey());
+
+                    // 如果不存在实例则新建.
+                    entity = (entity == null ? clazz.newInstance() : entity);
+                    // 从map中得到对应列的field.
+                    Field field = fieldsMap.get(entry.getKey());
+                    // 取得类型,并根据对象类型设置值.
+                    Class<?> fieldType = field.getType();
+                    if (String.class == fieldType)
+                    {
+                        String s = Convert.toStr(val);
+                        if (StrUtil.endWith(s, ".0"))
+                        {
+                            //    val = StrUtil.subBefore(s, ".0",false);
+                        }
+                        else
+                        {
+                            if (val instanceof Double)
+                            {
+                                String dateFormat = field.getAnnotation(Excel.class).dateFormat();
+                                if (Validator.isNotEmpty(dateFormat))
+                                {
+                                    val = DateUtils.parseDateToStr(dateFormat, (Date) val);
+                                }
+                                else
+                                {
+                                    val = Convert.toStr(val);
+                                }
+                            }
+                            if (val instanceof Date)
+                            {
+                                String dateFormat = field.getAnnotation(Excel.class).dateFormat();
+                                if (Validator.isNotEmpty(dateFormat))
+                                {
+                                    val = DateUtils.parseDateToStr(dateFormat, (Date) val);
+                                }
+                                else
+                                {
+                                    val = Convert.toStr(val);
+                                }
+                            }
+
+                        }
+                    }
+                    else if ((Integer.TYPE == fieldType || Integer.class == fieldType) && Validator.isNumber(Convert.toStr(val)))
+                    {
+                        val = Convert.toInt(val);
+                    }
+                    else if (Long.TYPE == fieldType || Long.class == fieldType)
+                    {
+                        val = Convert.toLong(val);
+                    }
+                    else if (Double.TYPE == fieldType || Double.class == fieldType)
+                    {
+                        val = Convert.toDouble(val);
+                    }
+                    else if (Float.TYPE == fieldType || Float.class == fieldType)
+                    {
+                        val = Convert.toFloat(val);
+                    }
+                    else if (BigDecimal.class == fieldType)
+                    {
+                        val = Convert.toBigDecimal(val);
+                    }
+                    else if (Date.class == fieldType)
+                    {
+                        if (val instanceof String)
+                        {
+                            val = DateUtils.parseDate(val);
+                        }
+                        else if (val instanceof Double)
+                        {
+                            val = DateUtil.getJavaDate((Double) val);
+                        }
+                    }
+                    else if (Boolean.TYPE == fieldType || Boolean.class == fieldType)
+                    {
+                        val = Convert.toBool(val, false);
+                    }
+                    if (Validator.isNotNull(fieldType))
+                    {
+                        Excel attr = field.getAnnotation(Excel.class);
+                        String propertyName = field.getName();
+                        if (Validator.isNotEmpty(attr.targetAttr()))
+                        {
+                            propertyName = field.getName() + "." + attr.targetAttr();
+                        }
+                        else if (Validator.isNotEmpty(attr.readConverterExp()))
+                        {
+                            val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator());
+                        }
+                        else if (Validator.isNotEmpty(attr.dictType()))
+                        {
+                            val = reverseDictByExp(Convert.toStr(val), attr.dictType(), attr.separator());
+                        }
+                        ReflectUtils.invokeSetter(entity, propertyName, val);
+                    }
+                }
+                list.add(entity);
+            }
+        }
+        return list;
+    }
+
     /**
      * 对list数据源将其里面的数据导入到excel表单
      *
@@ -343,6 +552,55 @@ public class ExcelUtil<T>
         return sheetsList;
     }
 
+    public String userProfileExport(String filePath, String sheetName)
+    {
+        OutputStream out = null;
+        try
+        {
+            FileInputStream inputStream = new FileInputStream(filePath);
+            String filename = encodingName(sheetName);
+            out = new FileOutputStream(getAbsoluteFile(filename));
+            byte[] buffer = new byte[1024];
+            int len = 0;
+            while ((len = inputStream.read(buffer)) != -1) {
+                out.write(buffer, 0, len);
+            }
+            return filename;
+        }
+        catch (Exception e)
+        {
+            log.error("导出学员资料异常{}", e.getMessage());
+            throw new CustomException("导出学员资料异常,请联系网站管理员!");
+        }
+        finally
+        {
+
+            if (wb != null)
+            {
+                try
+                {
+                    wb.close();
+                }
+                catch (IOException e1)
+                {
+                    e1.printStackTrace();
+                }
+            }
+            if (out != null)
+            {
+                try
+                {
+                    out.close();
+                }
+                catch (IOException e1)
+                {
+                    e1.printStackTrace();
+                }
+            }
+        }
+    }
+
+
     public AjaxResult exportEasyExcel(List<Map<String, Object>> sheetsList, String sheetName)
     {
         OutputStream out = null;
@@ -388,6 +646,57 @@ public class ExcelUtil<T>
         }
     }
 
+
+
+    public void exportEasyExcelStudy(List<Map<String, Object>> sheetsList,String path)
+    {
+        OutputStream out = null;
+        //     Workbook workbook = null;
+        try
+        {
+            Workbook workbook = ExcelExportUtil.exportExcel(sheetsList, ExcelType.HSSF);
+            File desc = new File(path);
+            if (!desc.getParentFile().exists())
+            {
+                desc.getParentFile().mkdirs();
+            }
+            out = new FileOutputStream(path);
+            workbook.write(out);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            log.error("导出Excel异常{}", e.getMessage());
+            throw new CustomException("导出Excel失败,请联系网站管理员!");
+        }
+        finally
+        {
+
+            if (wb != null)
+            {
+                try
+                {
+                    wb.close();
+                }
+                catch (IOException e1)
+                {
+                    e1.printStackTrace();
+                }
+            }
+            if (out != null)
+            {
+                try
+                {
+                    out.close();
+                }
+                catch (IOException e1)
+                {
+                    e1.printStackTrace();
+                }
+            }
+        }
+    }
+
     /**
      * 对list数据源将其里面的数据导入到excel表单
      *
@@ -936,6 +1245,15 @@ public class ExcelUtil<T>
         return filename;
     }
 
+    /**
+     * 编码文件名
+     */
+    public String encodingName(String filename)
+    {
+        filename = UUID.randomUUID().toString() + "_" + filename;
+        return filename;
+    }
+
     public String encodingFilename(String filename)
     {
         filename = UUID.randomUUID().toString() + "_" + filename + ".xlsx";

BIN
zhongzheng-common/src/main/resources/static/001.png


BIN
zhongzheng-common/src/main/resources/static/002.jpg


BIN
zhongzheng-common/src/main/resources/static/0020.jpg


BIN
zhongzheng-common/src/main/resources/static/0024.jpg


BIN
zhongzheng-common/src/main/resources/static/003.jpg


BIN
zhongzheng-common/src/main/resources/static/0030.jpg


BIN
zhongzheng-common/src/main/resources/static/00312.jpg


BIN
zhongzheng-common/src/main/resources/static/0033.jpg


BIN
zhongzheng-common/src/main/resources/static/004.jpg


BIN
zhongzheng-common/src/main/resources/static/005.jpg


BIN
zhongzheng-common/src/main/resources/static/0051.jpg


BIN
zhongzheng-common/src/main/resources/static/006.jpg


BIN
zhongzheng-common/src/main/resources/static/2323.jpg


+ 8 - 2
zhongzheng-framework/src/main/java/com/zhongzheng/framework/aspectj/LogAspect.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.framework.aspectj;
 
+import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.http.useragent.UserAgent;
 import cn.hutool.http.useragent.UserAgentUtil;
@@ -149,7 +150,10 @@ public class LogAspect
             String className = joinPoint.getTarget().getClass().getName();
             String methodName = joinPoint.getSignature().getName();
             operLog.setMethod(className + "." + methodName + "()");
-            operLog.setTenantId(Long.parseLong(ServletUtils.getRequest().getHeader("TenantId")));
+            String TenantId = ServletUtils.getRequest().getHeader("TenantId");
+            if(Validator.isNotEmpty(TenantId)){
+                operLog.setTenantId(Long.parseLong(TenantId));
+            }
             // 设置请求方式
             operLog.setRequestMethod(ServletUtils.getRequest().getMethod());
             // 处理设置注解上的参数
@@ -183,7 +187,9 @@ public class LogAspect
         operLog.setOperatorType(log.operatorType().ordinal());
         // 设置浏览器
         UserAgent userAgent = UserAgentUtil.parse(ServletUtils.getRequest().getHeader("User-Agent"));
-        operLog.setBrowser(userAgent.getBrowser().getName());
+        if(Validator.isNotEmpty(userAgent)){
+            operLog.setBrowser(userAgent.getBrowser().getName());
+        }
         // 是否需要保存request,参数和值
         if (log.isSaveRequestData())
         {

+ 1 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/config/MybatisPlusConfig.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerIntercept
 import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
 import com.zhongzheng.framework.mybatisplus.CreateAndUpdateMetaObjectHandler;
 import com.zhongzheng.framework.mybatisplus.CustomTenantLineHandler;
+import com.zhongzheng.framework.mybatisplus.CustomTenantLineInnerInterceptor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;

+ 18 - 5
zhongzheng-framework/src/main/java/com/zhongzheng/framework/config/SecurityConfig.java

@@ -129,26 +129,39 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                         "/**/*.js"
                 ).permitAll()
                 .antMatchers("/app/common/**").anonymous() //小程序非验证接口
+                .antMatchers("/sys/common/**").anonymous()
                 .antMatchers("/refreshToken/**").anonymous()
                 .antMatchers("/v1/test/**").anonymous()
                 .antMatchers("/profile/**").anonymous()
                 .antMatchers("/common/jzs/**").anonymous()
                 .antMatchers("/common/rollback/period").anonymous()
+                .antMatchers("/common/apply/**").anonymous()
                 .antMatchers("/common/decompression").anonymous()
-                .antMatchers("/common/del/file").anonymous()
                 .antMatchers("/common/merge/file").anonymous()
-                .antMatchers("/cd/exam/**").anonymous()
-                .antMatchers("/cd/subscribe/**").anonymous()
-                .antMatchers("/common/delete/file").anonymous()
-                .antMatchers("/course/handouts/**").anonymous()
                 .antMatchers("/common/get/goods").anonymous()
+                .antMatchers("/common/get/orderGoods").anonymous()
+                .antMatchers("/common/check/account").anonymous()
                 .antMatchers("/common/get/goods/studyUrl").anonymous()
+                .antMatchers("/common/apply/detail").anonymous()
+                .antMatchers("/common/external/question").anonymous()
+                .antMatchers("/common/replenish/exam").anonymous()
+                .antMatchers("/common/student/image/update").anonymous()
+                .antMatchers("/common/platform/pay").anonymous()
+                .antMatchers("/common/platform/pay/handle").anonymous()
+                .antMatchers("/common/alike/goods").anonymous()
                 .antMatchers("/common/create/tenant/admin").anonymous()
                 .antMatchers("/common/create/tenant/admin/old").anonymous()
                 .antMatchers("/common/update/role").anonymous()
+                .antMatchers("/common/question/import").anonymous()
+                .antMatchers("/common/question/*").anonymous()
                 .antMatchers("/common/free/**").anonymous()
                 .antMatchers("/common/download**").anonymous()
                 .antMatchers("/common/download/resource**").anonymous()
+                .antMatchers("/grade/grade/listPeriod").anonymous()
+                .antMatchers("/course/business/queryFullId").anonymous()
+                .antMatchers("/grade/grade/listUserPeriod").anonymous()
+                .antMatchers("/grade/grade/listPeriodAudit").anonymous()
+                .antMatchers("/grade/grade/listUserVideoRecord").anonymous()
                 .antMatchers("/swagger-ui.html").anonymous()
                 .antMatchers("/swagger-resources/**").anonymous()
                 .antMatchers("/webjars/**").anonymous()

+ 4 - 4
zhongzheng-framework/src/main/java/com/zhongzheng/framework/mybatisplus/CreateAndUpdateMetaObjectHandler.java

@@ -20,8 +20,8 @@ public class CreateAndUpdateMetaObjectHandler implements MetaObjectHandler {
 	public void insertFill(MetaObject metaObject) {
 		//根据属性名字设置要填充的值
 		if (metaObject.hasGetter("createTime")) {
-			if (metaObject.getValue("createTime") == null ) {
-				this.setFieldValByName("createTime", DateUtils.getNowTime(), metaObject);
+			if (metaObject.getValue("createTime") == null && enabledTenant) {
+				this.setFieldValByName("createTime", DateUtils.getNowDate(), metaObject);
 			}
 		}
 		if (metaObject.hasGetter("createBy")) {
@@ -39,8 +39,8 @@ public class CreateAndUpdateMetaObjectHandler implements MetaObjectHandler {
 			}
 		}
 		if (metaObject.hasGetter("updateTime")) {
-			if (metaObject.getValue("updateTime") == null ) {
-				this.setFieldValByName("updateTime", DateUtils.getNowTime(), metaObject);
+			if (metaObject.getValue("updateTime") == null && enabledTenant) {
+				this.setFieldValByName("updateTime", DateUtils.getNowDate(), metaObject);
 			}
 		}
 	}

+ 2 - 2
zhongzheng-framework/src/main/java/com/zhongzheng/framework/mybatisplus/CustomTenantLineHandler.java

@@ -54,9 +54,9 @@ public class CustomTenantLineHandler implements TenantLineHandler {
     @SneakyThrows
     @Override
     public Expression getTenantId() {
-        String TenantId = ServletUtils.getRequest().getHeader("TenantId");
+        String TenantId = ServletUtils.getResponse().getHeader("TenantId");
         if(Validator.isEmpty(TenantId)){
-            TenantId = ServletUtils.getResponse().getHeader("TenantId");
+            TenantId = ServletUtils.getRequest().getHeader("TenantId");
             if(enabledTenant){
                 if(Validator.isEmpty(TenantId)){
                     int code = HttpStatus.HTTP_UNAVAILABLE;

+ 82 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/mybatisplus/CustomTenantLineInnerInterceptor.java

@@ -0,0 +1,82 @@
+package com.zhongzheng.framework.mybatisplus;
+
+import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
+import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
+import net.sf.jsqlparser.expression.Expression;
+import net.sf.jsqlparser.expression.Parenthesis;
+import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
+import net.sf.jsqlparser.expression.operators.conditional.OrExpression;
+import net.sf.jsqlparser.expression.operators.relational.InExpression;
+import net.sf.jsqlparser.expression.operators.relational.MultiExpressionList;
+import net.sf.jsqlparser.schema.Column;
+import net.sf.jsqlparser.schema.Table;
+import net.sf.jsqlparser.statement.delete.Delete;
+import net.sf.jsqlparser.statement.insert.Insert;
+import net.sf.jsqlparser.statement.select.SelectBody;
+import net.sf.jsqlparser.statement.update.Update;
+import org.springframework.stereotype.Component;
+
+
+public class CustomTenantLineInnerInterceptor extends TenantLineInnerInterceptor {
+    private TenantLineHandler tenantLineHandler;
+    public CustomTenantLineInnerInterceptor(TenantLineHandler tenantLineHandler) {
+        super(tenantLineHandler);
+        this.tenantLineHandler = tenantLineHandler;
+    }
+
+
+    @Override
+    protected Expression builderExpression(Expression currentExpression, Table table) {
+        Column aliasColumn = this.getAliasColumn(table);
+        boolean presenceOfField=true;
+        if(!this.tenantLineHandler.ignoreTable(table.getName())) {
+            FindInSetExpression findInSetExpression = new FindInSetExpression();
+            findInSetExpression.setLeftExpression(getTenantLineHandler().getTenantId());
+            findInSetExpression.setRightExpression(aliasColumn);
+            if (currentExpression == null) {
+                return findInSetExpression;
+            } else {
+                return currentExpression instanceof OrExpression ? new AndExpression(new Parenthesis(currentExpression), findInSetExpression) : new AndExpression(currentExpression, findInSetExpression);
+            }
+        }else{
+            return currentExpression;
+        }
+
+    }
+
+    @Override
+    protected void processInsert(Insert insert, int index, String sql, Object obj) {
+        super.processInsert(insert,index,sql,obj);
+    }
+
+    @Override
+    protected void processUpdate(Update update, int index, String sql, Object obj) {
+        Table table = update.getTable();
+        if (!this.tenantLineHandler.ignoreTable(table.getName())) {
+            Column aliasColumn = this.getAliasColumn(table);
+            FindInSetExpression findInSetExpression = new FindInSetExpression();
+            findInSetExpression.setLeftExpression(getTenantLineHandler().getTenantId());
+            findInSetExpression.setRightExpression(aliasColumn);
+            Expression where = update.getWhere() instanceof OrExpression ? new AndExpression(new Parenthesis(update.getWhere()), findInSetExpression) : new AndExpression(update.getWhere(), findInSetExpression);
+            update.setWhere(where);
+        }
+    }
+
+    @Override
+    protected void processDelete(Delete delete, int index, String sql, Object obj) {
+        Table table = delete.getTable();
+        if (!this.tenantLineHandler.ignoreTable(table.getName())) {
+            Column aliasColumn = this.getAliasColumn(table);
+            FindInSetExpression findInSetExpression = new FindInSetExpression();
+            findInSetExpression.setLeftExpression(getTenantLineHandler().getTenantId());
+            findInSetExpression.setRightExpression(aliasColumn);
+            Expression where = delete.getWhere() instanceof OrExpression ? new AndExpression(new Parenthesis(delete.getWhere()), findInSetExpression) : new AndExpression(delete.getWhere(), findInSetExpression);
+            delete.setWhere(where);
+        }
+    }
+
+    @Override
+    protected void processInsertSelect(SelectBody selectBody) {
+        super.processInsertSelect(selectBody);
+    }
+}

+ 120 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/mybatisplus/FindInSetExpression.java

@@ -0,0 +1,120 @@
+package com.zhongzheng.framework.mybatisplus;
+
+import net.sf.jsqlparser.expression.Expression;
+import net.sf.jsqlparser.expression.ExpressionVisitor;
+import net.sf.jsqlparser.expression.operators.relational.ItemsList;
+import net.sf.jsqlparser.expression.operators.relational.MultiExpressionList;
+import net.sf.jsqlparser.expression.operators.relational.SupportsOldOracleJoinSyntax;
+import net.sf.jsqlparser.parser.ASTNodeAccessImpl;
+
+public class FindInSetExpression extends ASTNodeAccessImpl implements Expression {
+    private Expression leftExpression;
+    private ItemsList leftItemsList;
+    private ItemsList rightItemsList;
+    private boolean not = false;
+    private Expression rightExpression;
+    private MultiExpressionList multiExpressionList;
+    private int oldOracleJoinSyntax = 0;
+
+    public FindInSetExpression() {
+    }
+
+    public FindInSetExpression(Expression leftExpression, ItemsList itemsList) {
+        this.setLeftExpression(leftExpression);
+        this.setRightItemsList(itemsList);
+    }
+
+    public void setOldOracleJoinSyntax(int oldOracleJoinSyntax) {
+        this.oldOracleJoinSyntax = oldOracleJoinSyntax;
+        if (oldOracleJoinSyntax < 0 || oldOracleJoinSyntax > 1) {
+            throw new IllegalArgumentException("unexpected join type for oracle found with IN (type=" + oldOracleJoinSyntax + ")");
+        }
+    }
+
+    public int getOldOracleJoinSyntax() {
+        return this.oldOracleJoinSyntax;
+    }
+
+    public ItemsList getRightItemsList() {
+        return this.rightItemsList;
+    }
+
+    public Expression getLeftExpression() {
+        return this.leftExpression;
+    }
+
+    public final void setRightItemsList(ItemsList list) {
+        this.rightItemsList = list;
+    }
+
+    public final void setLeftExpression(Expression expression) {
+        this.leftExpression = expression;
+    }
+
+    public boolean isNot() {
+        return this.not;
+    }
+
+    public void setNot(boolean b) {
+        this.not = b;
+    }
+
+    public ItemsList getLeftItemsList() {
+        return this.leftItemsList;
+    }
+
+    public void setLeftItemsList(ItemsList leftItemsList) {
+        this.leftItemsList = leftItemsList;
+    }
+
+    public Expression getRightExpression() {
+        return this.rightExpression;
+    }
+
+    public void setRightExpression(Expression rightExpression) {
+        this.rightExpression = rightExpression;
+    }
+
+
+
+    private String getLeftExpressionString() {
+        return this.leftExpression + (this.oldOracleJoinSyntax == 1 ? "(+)" : "");
+    }
+
+    public String toString() {
+        StringBuilder statementBuilder = new StringBuilder();
+
+        statementBuilder.append("FIND_IN_SET ");
+        statementBuilder.append("(");
+        statementBuilder.append(this.getLeftExpressionString());
+        statementBuilder.append(",");
+        statementBuilder.append(this.rightExpression);
+        statementBuilder.append(")");
+
+        return statementBuilder.toString();
+    }
+
+    public int getOraclePriorPosition() {
+        return 0;
+    }
+
+    public void setOraclePriorPosition(int priorPosition) {
+        if (priorPosition != 0) {
+            throw new IllegalArgumentException("unexpected prior for oracle found");
+        }
+    }
+
+    public MultiExpressionList getMultiExpressionList() {
+        return this.multiExpressionList;
+    }
+
+    public void setMultiExpressionList(MultiExpressionList multiExpressionList) {
+        this.multiExpressionList = multiExpressionList;
+    }
+
+    @Override
+    public void accept(ExpressionVisitor expressionVisitor) {
+
+    }
+}
+

+ 11 - 4
zhongzheng-framework/src/main/java/com/zhongzheng/framework/security/filter/JwtAuthenticationTokenFilter.java

@@ -4,6 +4,7 @@ import cn.hutool.core.lang.Validator;
 import cn.hutool.http.HttpStatus;
 import com.zhongzheng.common.core.domain.AjaxResult;
 import com.zhongzheng.common.core.domain.model.TopLoginUser;
+import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.framework.web.service.TopTokenService;
 import com.zhongzheng.modules.user.entity.ClientLoginSeller;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
@@ -55,10 +56,15 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
             if(StringUtils.isNoneEmpty(wxToken)){
                 ClientLoginUser clientLoginUser = wxTokenService.getLoginUser(request);
                 if(clientLoginUser!=null){
-                    wxTokenService.verifyToken(clientLoginUser);
-                    UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(clientLoginUser, null,null);
-                    authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
-                    SecurityContextHolder.getContext().setAuthentication(authenticationToken);
+                    if(Validator.isNull(clientLoginUser.getUser())){
+                        request.getRequestDispatcher("/app/common/token_offline").forward(request, response);
+                        return;
+                    }else{
+                        wxTokenService.verifyToken(clientLoginUser);
+                        UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(clientLoginUser, null,null);
+                        authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
+                        SecurityContextHolder.getContext().setAuthentication(authenticationToken);
+                    }
                 }
             }else{
                 if(!enabledTenant){
@@ -88,6 +94,7 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
             }
         }catch (Exception e){
             request.getRequestDispatcher("/filter/token_auth_fail").forward(request, response);
+            return;
         }
         chain.doFilter(request, response);
     }

+ 2 - 3
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/DistributionSellerServiceImpl.java

@@ -3,7 +3,7 @@ package com.zhongzheng.framework.web.service;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
-import com.baomidou.dynamic.datasource.annotation.DS;
+
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
@@ -54,7 +54,6 @@ import java.util.stream.Collectors;
  * @date 2023-03-13
  */
 @Service
-@DS("slave")
 public class DistributionSellerServiceImpl extends ServiceImpl<DistributionSellerMapper, DistributionSeller> implements IDistributionSellerService {
 
     @Autowired
@@ -93,7 +92,7 @@ public class DistributionSellerServiceImpl extends ServiceImpl<DistributionSelle
         if(Validator.isEmpty(bo.getRealname())){
             throw new CustomException("姓名不能为空");
         }
-        if(!ToolsUtils.verifPwd(bo.getPwd())){
+        if(!ToolsUtils.verifEasyPwd(bo.getPwd())){
             throw new CustomException("密码应由8-16位数字、大小写字母、符号组成");
         }
         String key = Constants.REGISTER_SMS + bo.getTel();

+ 1 - 1
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/SysLoginService.java

@@ -189,7 +189,7 @@ public class SysLoginService
             }
             Long nowTime = DateUtils.getNowTime();
             Long paramTime = Long.valueOf(param[1]);
-            if(Validator.isEmpty(paramTime)||Math.abs(paramTime.longValue()-nowTime.longValue())>30){
+            if(Validator.isEmpty(paramTime)){
                 throw new CustomException("参数内容错误");
             }
         }

+ 116 - 8
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/SysTenantServiceImpl.java

@@ -3,10 +3,13 @@ package com.zhongzheng.framework.web.service;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
-import com.baomidou.dynamic.datasource.annotation.DS;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
@@ -15,17 +18,23 @@ import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.SecurityUtils;
 import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.modules.order.domain.Order;
+import com.zhongzheng.modules.order.service.IOrderService;
 import com.zhongzheng.modules.system.bo.*;
 import com.zhongzheng.modules.system.domain.SysRoleMenu;
 import com.zhongzheng.modules.system.domain.SysTenant;
 import com.zhongzheng.modules.system.mapper.SysRoleMenuMapper;
 import com.zhongzheng.modules.system.mapper.SysTenantMapper;
 import com.zhongzheng.modules.system.service.*;
+import com.zhongzheng.modules.system.vo.SysTenantAccountVo;
+import com.zhongzheng.modules.system.vo.SysTenantBankAccountVo;
 import com.zhongzheng.modules.system.vo.SysTenantVo;
+import com.zhongzheng.modules.top.goods.domain.TopOldOrder;
+import com.zhongzheng.modules.top.goods.service.ITopOldOrderService;
 import org.apache.commons.lang3.RandomStringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.ArrayList;
@@ -39,8 +48,7 @@ import java.util.stream.Collectors;
  * @author hjl
  * @date 2021-08-03
  */
-@Service
-@DS("slave") //指定数据源
+@Service //指定数据源
 public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant> implements ISysTenantService {
 
     @Autowired
@@ -67,6 +75,15 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
     @Autowired
     private ISysDictTypeService iSysDictTypeService;
 
+    @Autowired
+    @Lazy
+    private ITopOldOrderService topOldOrderService;
+
+    @Autowired
+    @Lazy
+    private IOrderService orderService;
+
+
     @Override
     public SysTenantVo queryById(Long tenantId){
         SysTenant db = this.baseMapper.selectById(tenantId);
@@ -76,8 +93,10 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
     @Override
     public List<SysTenantVo> queryList(SysTenantQueryBo bo) {
         LambdaQueryWrapper<SysTenant> lqw = Wrappers.lambdaQuery();
-        lqw.eq(bo.getStatus() != null, SysTenant::getStatus, bo.getStatus());
+        lqw.ne(SysTenant::getStatus, -1);
         lqw.like(StrUtil.isNotBlank(bo.getTenantName()), SysTenant::getTenantName, bo.getTenantName());
+        lqw.eq(ObjectUtils.isNotNull(bo.getTenantid()),SysTenant::getTenantId, bo.getTenantid());
+        lqw.orderByDesc(SysTenant::getSort);
         return entity2Vo(this.list(lqw));
     }
 
@@ -89,7 +108,19 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
     */
     private List<SysTenantVo> entity2Vo(Collection<SysTenant> collection) {
         List<SysTenantVo> voList = collection.stream()
-                .map(any -> BeanUtil.toBean(any, SysTenantVo.class))
+                .map(any -> {
+                    SysTenantVo sysTenantVo = BeanUtil.toBean(any, SysTenantVo.class);
+                    if (StringUtils.isNotBlank(any.getAccountInformation())){
+                        String accountInformation = any.getAccountInformation();
+                        List<SysTenantAccountVo> accountVo = JSONArray.parseArray(accountInformation, SysTenantAccountVo.class);
+                        sysTenantVo.setAccountList(accountVo);
+                    }
+                    if (StringUtils.isNotBlank(any.getInvoiceInformation())){
+                        SysTopTenantInvoiceBo invoiceBo = JSONObject.parseObject(any.getInvoiceInformation(), SysTopTenantInvoiceBo.class);
+                        sysTenantVo.setInvoiceBo(invoiceBo);
+                    }
+                    return sysTenantVo;
+                })
                 .collect(Collectors.toList());
         if (collection instanceof Page) {
             Page<SysTenant> page = (Page<SysTenant>)collection;
@@ -263,7 +294,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
     }
 
     @Override
-    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
+    
     public List<SysTenant> getListSysTenant() {
         return list(new LambdaQueryWrapper<SysTenant>().eq(SysTenant::getStatus, 1));
     }
@@ -372,7 +403,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
             }
             dictData.setDictCode(null);
             dictData.setDictTypeId(dictType1.getDictId());
-            dictData.setTenantId(newTenantId);
+            dictData.setTenantId(newTenantId.toString());
         }
         iSysDictDataService.saveBatch(dictDatas);
     }
@@ -393,6 +424,83 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
         }
     }
 
+    @Override
+    public List<SysTenantBankAccountVo> getBankAccountList(String tenantId) {
+        SysTenant tenant = getById(Long.valueOf(tenantId));
+        if (ObjectUtils.isNull(tenant)){
+            throw new CustomException("机构信息获取失败!");
+        }
+        if (StringUtils.isBlank(tenant.getAccountInformation())){
+            return new ArrayList<>();
+        }
+        String accountInformation = tenant.getAccountInformation();
+        return JSONArray.parseArray(accountInformation,SysTenantBankAccountVo.class);
+    }
+
+    @Override
+    public boolean addTopTenant(SysTopTenantAddBo bo) {
+        SysTenant add = BeanUtil.toBean(bo, SysTenant.class);
+        validEntityBeforeSave(add);
+        add.setTenantId(createTenantId());
+        add.setCreateTime(DateUtils.getNowTime());
+        add.setUpdateTime(DateUtils.getNowTime());
+        add.setStatus(1);
+        if (ObjectUtils.isNotNull(bo.getAccountList())){
+            add.setAccountInformation(JSONArray.toJSONString(bo.getAccountList()));
+        }
+        if (ObjectUtils.isNotNull(bo.getInvoiceBo())){
+            add.setInvoiceInformation(JSONObject.toJSONString(bo.getInvoiceBo()));
+        }
+        return this.save(add);
+    }
+
+    @Override
+    public boolean editTopTenant(SysTopTenantEditBo bo) {
+        SysTenant tenant = getById(bo.getTenantId());
+        if (ObjectUtils.isNull(tenant)){
+            throw new CustomException("机构信息有误");
+        }
+        tenant.setTenantName(bo.getTenantName());
+//        if(checkNameUnique(tenant)){
+//            throw new CustomException("公司名已存在");
+//        }
+        tenant.setHostH5(bo.getHostH5());
+        tenant.setHostPc(bo.getHostPc());
+        tenant.setBillType(bo.getBillType());
+        tenant.setBillDay(bo.getBillDay());
+        tenant.setAccountInformation(JSONArray.toJSONString(bo.getAccountList()));
+        tenant.setInvoiceInformation(JSONObject.toJSONString(bo.getInvoiceBo()));
+        tenant.setEduPhone(bo.getEduPhone());
+        return updateById(tenant);
+    }
+
+    @Override
+    public boolean deleteTopTenant(SysTopTenantEditBo bo) {
+        if (CollectionUtils.isEmpty(bo.getTenantIds())){
+            throw new CustomException("参数错误");
+        }
+        for (Long tenantId : bo.getTenantIds()) {
+            int count = topOldOrderService.count(new LambdaQueryWrapper<TopOldOrder>().eq(TopOldOrder::getTenantId, tenantId));
+            int num = orderService.count(new LambdaQueryWrapper<Order>().eq(Order::getTenantId, tenantId));
+            if (count > 0 || num > 0){
+                throw new CustomException("机构已有订单信息,请勿删除!");
+            }
+        }
+        return update(new LambdaUpdateWrapper<SysTenant>()
+        .in(SysTenant::getTenantId,bo.getTenantIds())
+        .set(SysTenant::getStatus,-1));
+    }
+
+    @Override
+    public List<SysTenant> getListNoTenant(Long tenantId) {
+        return baseMapper.getListNoTenant(tenantId);
+    }
+
+    @Override
+    public List<SysTenant> getExamRoomTenant() {
+        return baseMapper.getExamRoomTenant();
+    }
+
     private void initRoles(Long newTenantId,Long tenantId) {
         List<String> roleKey = new ArrayList<>();
         roleKey.add("seller");

+ 2 - 2
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/TokenService.java

@@ -98,7 +98,7 @@ public class TokenService
         {
             // 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
             authentication = authenticationManager
-                    .authenticate(new UsernamePasswordAuthenticationToken("admin", "admin123"));
+                    .authenticate(new UsernamePasswordAuthenticationToken("admin", "admin159"));
         }
         catch (Exception e)
         {
@@ -114,7 +114,7 @@ public class TokenService
             }
         }
         LoginUser loginUser = (LoginUser) authentication.getPrincipal();
-        loginUser.setExpireTime(System.currentTimeMillis()+200);
+        loginUser.setExpireTime(System.currentTimeMillis());
         return loginUser;
     }
 

+ 137 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserLoginKeyServiceImpl.java

@@ -0,0 +1,137 @@
+package com.zhongzheng.framework.web.service;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.lang.Validator;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.Page;
+import com.zhongzheng.common.core.redis.RedisCache;
+import com.zhongzheng.common.exception.CustomException;
+import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.modules.user.bo.UserLoginKeyAddBo;
+import com.zhongzheng.modules.user.bo.UserLoginKeyEditBo;
+import com.zhongzheng.modules.user.bo.UserLoginKeyQueryBo;
+import com.zhongzheng.modules.user.domain.UserLoginKey;
+import com.zhongzheng.modules.user.mapper.UserLoginKeyMapper;
+import com.zhongzheng.modules.user.service.IUserLoginKeyService;
+import com.zhongzheng.modules.user.vo.UserLoginKeyVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 用户登录KEYService业务层处理
+ *
+ * @author hjl
+ * @date 2023-06-14
+ */
+@Service
+public class UserLoginKeyServiceImpl extends ServiceImpl<UserLoginKeyMapper, UserLoginKey> implements IUserLoginKeyService {
+
+    @Autowired
+    private RedisCache redisCache;
+
+    @Override
+    public UserLoginKeyVo queryById(Long id){
+        UserLoginKey db = this.baseMapper.selectById(id);
+        return BeanUtil.toBean(db, UserLoginKeyVo.class);
+    }
+
+    @Override
+    public Boolean queryByUserKey(String userKey) {
+        UserLoginKey loginKey = getOne(new LambdaQueryWrapper<UserLoginKey>()
+                .eq(UserLoginKey::getUserKey, userKey).last("limit 1"));
+        if(Validator.isNotEmpty(loginKey)&&loginKey.getStatus()==0){
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public List<UserLoginKeyVo> queryList(UserLoginKeyQueryBo bo) {
+        LambdaQueryWrapper<UserLoginKey> lqw = Wrappers.lambdaQuery();
+        lqw.eq(bo.getUserId() != null, UserLoginKey::getUserId, bo.getUserId());
+        lqw.eq(StrUtil.isNotBlank(bo.getUserKey()), UserLoginKey::getUserKey, bo.getUserKey());
+        lqw.eq(bo.getStatus() != null, UserLoginKey::getStatus, bo.getStatus());
+        lqw.eq(StrUtil.isNotBlank(bo.getIp()), UserLoginKey::getIp, bo.getIp());
+        lqw.eq(StrUtil.isNotBlank(bo.getBrowser()), UserLoginKey::getBrowser, bo.getBrowser());
+        return entity2Vo(this.list(lqw));
+    }
+
+    /**
+    * 实体类转化成视图对象
+    *
+    * @param collection 实体类集合
+    * @return
+    */
+    private List<UserLoginKeyVo> entity2Vo(Collection<UserLoginKey> collection) {
+        List<UserLoginKeyVo> voList = collection.stream()
+                .map(any -> BeanUtil.toBean(any, UserLoginKeyVo.class))
+                .collect(Collectors.toList());
+        if (collection instanceof Page) {
+            Page<UserLoginKey> page = (Page<UserLoginKey>)collection;
+            Page<UserLoginKeyVo> pageVo = new Page<>();
+            BeanUtil.copyProperties(page,pageVo);
+            pageVo.addAll(voList);
+            voList = pageVo;
+        }
+        return voList;
+    }
+
+    @Override
+    public Boolean insertByAddBo(UserLoginKeyAddBo bo) {
+        UserLoginKey add = BeanUtil.toBean(bo, UserLoginKey.class);
+        validEntityBeforeSave(add);
+        add.setCreateTime(DateUtils.getNowTime());
+        add.setUpdateTime(DateUtils.getNowTime());
+        return this.save(add);
+    }
+
+    @Override
+    public Boolean updateByEditBo(UserLoginKeyEditBo bo) {
+        UserLoginKey update = BeanUtil.toBean(bo, UserLoginKey.class);
+        validEntityBeforeSave(update);
+        update.setUpdateTime(DateUtils.getNowTime());
+        return this.updateById(update);
+    }
+
+    /**
+     * 保存前的数据校验
+     *
+     * @param entity 实体类数据
+     */
+    private void validEntityBeforeSave(UserLoginKey entity){
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if(isValid){
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return this.removeByIds(ids);
+    }
+
+    @Override
+    public Boolean offline(UserLoginKeyEditBo bo) {
+        if(Validator.isEmpty(bo.getUserId())||Validator.isEmpty(bo.getUserKey())){
+            throw new CustomException("参数错误");
+        }
+        LambdaUpdateWrapper<UserLoginKey> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+        objectLambdaUpdateWrapper.eq(UserLoginKey::getUserId, bo.getUserId());
+        objectLambdaUpdateWrapper.ne(UserLoginKey::getUserKey, bo.getUserKey());
+        objectLambdaUpdateWrapper.set(UserLoginKey::getStatus, 0);
+        this.update(null, objectLambdaUpdateWrapper);
+        String key = "LockAppAction_"+"bank"+"-"+bo.getUserId();
+        String key2 = "LockAppAction_"+"jxjy"+"-"+bo.getUserId();
+        redisCache.deleteObject(key);
+        redisCache.deleteObject(key2);
+        return true;
+    }
+}

+ 651 - 15
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -1,10 +1,12 @@
 package com.zhongzheng.framework.web.service;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.codec.Base64;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -14,6 +16,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
+import com.google.common.base.Splitter;
 import com.zhongzheng.common.constant.Constants;
 import com.zhongzheng.common.core.domain.model.LoginUser;
 import com.zhongzheng.common.core.redis.RedisCache;
@@ -22,6 +25,7 @@ import com.zhongzheng.common.exception.BaseException;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.type.EncryptHandler;
 import com.zhongzheng.common.utils.*;
+import com.zhongzheng.common.utils.http.HttpUtils;
 import com.zhongzheng.common.utils.ip.IpUtils;
 import com.zhongzheng.modules.alisms.service.IAliSmsService;
 import com.zhongzheng.modules.collect.domain.CollectBank;
@@ -30,19 +34,34 @@ import com.zhongzheng.modules.collect.domain.CollectNote;
 import com.zhongzheng.modules.collect.mapper.CollectBankMapper;
 import com.zhongzheng.modules.collect.mapper.CollectCourseMapper;
 import com.zhongzheng.modules.collect.mapper.CollectNoteMapper;
+import com.zhongzheng.modules.course.domain.Course;
+import com.zhongzheng.modules.course.domain.CourseSection;
 import com.zhongzheng.modules.course.domain.CourseSubject;
+import com.zhongzheng.modules.course.service.ICourseSectionService;
+import com.zhongzheng.modules.course.service.ICourseService;
 import com.zhongzheng.modules.course.service.ICourseSubjectService;
+import com.zhongzheng.modules.goods.domain.Goods;
+import com.zhongzheng.modules.goods.service.IGoodsService;
+import com.zhongzheng.modules.goods.vo.UserNewGoodsVo;
 import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
 import com.zhongzheng.modules.grade.service.IClassGradeUserService;
+import com.zhongzheng.modules.grade.service.impl.ClassGradeServiceImpl;
 import com.zhongzheng.modules.grade.vo.ClassGradeUserGoodsVo;
+import com.zhongzheng.modules.system.domain.SysTenant;
 import com.zhongzheng.modules.system.service.ISysConfigService;
+import com.zhongzheng.modules.system.service.ISysTenantService;
 import com.zhongzheng.modules.user.bo.*;
-import com.zhongzheng.modules.user.domain.*;
+import com.zhongzheng.modules.user.domain.User;
+import com.zhongzheng.modules.user.domain.UserStudyLog;
+import com.zhongzheng.modules.user.domain.UserVisitLog;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import com.zhongzheng.modules.user.mapper.UserMapper;
 import com.zhongzheng.modules.user.service.*;
 import com.zhongzheng.modules.user.vo.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -65,6 +84,8 @@ import java.util.stream.Collectors;
 @Service
 public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {
 
+    private static Logger log = LoggerFactory.getLogger(UserServiceImpl.class);
+
     @Autowired
     private CollectCourseMapper collectCourseMapper;
 
@@ -114,6 +135,19 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     private IUserLoginErrorService iUserLoginErrorService;
     @Autowired
     private  ISysConfigService configService;
+    @Autowired
+    private IGoodsService iGoodsService;
+    @Autowired
+    private ISysTenantService iSysTenantService;
+
+    @Autowired
+    private ICourseService iCourseService;
+    @Autowired
+    private ICourseSectionService iCourseSectionService;
+    @Value("${liveGotoURL}")
+    private String liveGotoURL;
+    @Value("${oldSys.goods}")
+    private String OLD_GOODS;
 
 
     @Override
@@ -174,7 +208,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     @Override
     public List<UserVo> selectList(UserQueryBo bo) {
         bo.setGetOrderNum(1L);
-        List<UserVo> list = entity2UserVo(userMapper.selectList(bo));
+        List<UserVo> list = entity2UserVo(userMapper.selectListNoTenant(bo));
         for (UserVo userVo : list) {
             userVo.setStudentCode(userVo.getUserAccount());
             ClassGradeUserQueryBo classGradeUserQueryBo = new ClassGradeUserQueryBo();
@@ -182,13 +216,31 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
             List<Integer> status = new ArrayList<>();
             status.add(1);
             classGradeUserQueryBo.setStatus(status);
-            List<ClassGradeUserGoodsVo> classGradeUserGoodsVos = iClassGradeUserService.listUser(classGradeUserQueryBo);
+            List<ClassGradeUserGoodsVo> classGradeUserGoodsVos = iClassGradeUserService.listUserNoTenant(classGradeUserQueryBo);
             userVo.setClassGradeUserGoodsVoList(classGradeUserGoodsVos);
             userVo.setOrderNum(userVo.getGoodsCourseNum());
+
+            UserVisitLog userVisitLog = iUserVisitLogService.getOneNoTenant(userVo.getUserId());
+            if(Validator.isNotEmpty(userVisitLog)){
+                userVo.setLastVisitTime(userVisitLog.getCreateTime());
+                userVo.setVisitFromPlat(Integer.parseInt(userVisitLog.getFromPlat()));
+            }
+
+            UserStudyLog userStudyLog = iUserStudyLogService.getOneNoTenant( userVo.getUserId());
+            if(Validator.isNotEmpty(userStudyLog)){
+                userVo.setLastStudyTime(userStudyLog.getCreateTime());
+                userVo.setStudyFromPlat(Integer.parseInt(userStudyLog.getFromPlat()));
+            }
         }
         return list;
     }
 
+    @Override
+    public List<UserVo> dangAnList(UserQueryBo bo) {
+        List<User> list = baseMapper.dangAnList(bo);
+        return entity2UserVo(list);
+    }
+
     @Override
     public List<UserStatstVo> statsList(UserQueryBo bo) {
         List<UserStatstVo> list = new ArrayList<>();
@@ -228,7 +280,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
     @Override
     public List<UserExportVo> selectListExport(UserQueryBo bo) {
         bo.setGetOrderNum(1L);
-        List<UserVo> list = entity2UserVo(userMapper.selectList(bo));
+        List<UserVo> list = entity2UserVo(userMapper.selectListByBo(bo));
         List<UserExportVo> listExport = new ArrayList<>();
         for (UserVo userVo : list) {
             userVo.setStudentCode(userVo.getUserAccount());
@@ -654,6 +706,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         SnowflakeIdUtils idWorker = new SnowflakeIdUtils(3, 1);
         inertData.setUserAccount(String.valueOf(idWorker.nextId()));
         inertData.setSex(1);
+        if (ObjectUtils.isNotNull(bo.getEduLevel())){
+            inertData.setEduLevel(bo.getEduLevel());
+        }
+        if (ObjectUtils.isNotNull(bo.getSexNum())){
+            inertData.setSex(bo.getSexNum());
+        }
         if (ObjectUtils.isNotNull(bo.getIdcard())){
             inertData.setIdCard(bo.getIdcard());
         }
@@ -677,7 +735,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         if(!save(inertData)){
             throw new CustomException("注册失败");
         }
-        iSmsService.sendPwdSms(bo.getTel(),pwd);
+//        iSmsService.sendPwdSms(bo.getTel(),pwd);
         return inertData.getUserId();
     }
 
@@ -692,7 +750,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         if(bo.getPwd()==null){
             throw new CustomException("密码不能为空");
         }
-        if(!ToolsUtils.verifPwd(bo.getPwd())){
+        if(!ToolsUtils.verifEasyPwd(bo.getPwd())){
             throw new CustomException("密码应由8-16位数字、大小写字母、符号组成");
         }
         String key = Constants.REGISTER_SMS + bo.getTel();
@@ -825,6 +883,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
             SnowflakeIdUtils idWorker = new SnowflakeIdUtils(3, 1);
             inertData.setUserAccount(String.valueOf(idWorker.nextId()));
             inertData.setSex(1);
+            if(Validator.isNotEmpty(itemImport.getSex())){
+                inertData.setSex(itemImport.getSex().equals("女")?2:1);
+            }
+            if(Validator.isNotEmpty(itemImport.getEduLevel())){
+                inertData.setEduLevel(itemImport.getEduLevel());
+            }
             inertData.setIdCard(itemImport.getIdCard());
             inertData.setRealname(itemImport.getRealname());
             if (StringUtils.isNotBlank(itemImport.getCompanyName())) {
@@ -849,7 +913,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
                 errorList.add(itemImport);
                 continue;
             }
-            iSmsService.sendPwdSms(itemImport.getTelphone(),pwd);
+//            iSmsService.sendPwdSms(itemImport.getTelphone(),pwd);
             itemImport.setUserId(inertData.getUserId());
             itemImport.setImportNo(importNo);
             itemImport.setStudentCode(inertData.getUserAccount());
@@ -877,7 +941,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         {
             throw new BaseException("新密码格式错误");
         }
-        if(!ToolsUtils.verifPwd(bo.getNewPwd())){
+        if(!ToolsUtils.verifEasyPwd(bo.getNewPwd())){
             throw new CustomException("密码应由8-16位数字、大小写字母、符号组成");
         }
         user.setPassword(SecurityUtils.encryptPassword(bo.getNewPwd()));
@@ -887,6 +951,26 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         return true;
     }
 
+    @Override
+    public Boolean updatePwdByClient(UserAppUpdatePwdBo bo) {
+        User user = getOne(new LambdaQueryWrapper<User>().eq(User::getUserId, bo.getUserId()));
+        if(Validator.isEmpty(user)){
+            throw new BaseException("用户信息错误");
+        }
+        if (Validator.isEmpty(bo.getNewPwd()))
+        {
+            throw new BaseException("新密码格式错误");
+        }
+        if(!ToolsUtils.verifEasyPwd(bo.getNewPwd())){
+            throw new CustomException("密码应由6-18位组成");
+        }
+        user.setPassword(SecurityUtils.encryptPassword(bo.getNewPwd()));
+        user.setPwdTime(DateUtils.getNowTime());
+        user.setUpdateTime(DateUtils.getNowTime());
+        updateById(user);
+        return true;
+    }
+
     @Override
     public List<UserIdCardBatchVo> batchUserId(List<UserIdCardAddBo> list) {
         List<UserIdCardBatchVo> list1 = new ArrayList<>();
@@ -894,6 +978,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
             if(Validator.isEmpty(bo.getTelphone())){
                 throw new CustomException("用户手机号码缺失");
             }
+            log.info("批量获取用户ID" + JSON.toJSONString(bo));
 //            if(Validator.isEmpty(bo.getIdCard())){
 //                throw new CustomException("用户身份证号码缺失");
 //            }
@@ -910,8 +995,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
             }
             User user1 = getOne(new LambdaQueryWrapper<User>()
                     .eq(User::getTelphone,EncryptHandler.encrypt(bo.getTelphone())).last("limit 1"));
-            //手机号码存在
-            if(Validator.isNotEmpty(user1)){
+            //手机号码存在 身份证一致
+            if(Validator.isNotEmpty(user1) &&
+                    Validator.isNotEmpty(bo.getIdCard())&&Validator.isNotEmpty(user1.getIdCard())
+                    && EncryptHandler.decrypt(user1.getIdCard()).equals(bo.getIdCard())
+            ){
                 UserIdCardBatchVo user = BeanUtil.toBean(bo, UserIdCardBatchVo.class);
 //                if(Validator.isNotEmpty(bo.getIdCard())&&Validator.isNotEmpty(user1.getIdCard())&&!user1.getIdCard().equals(bo.getIdCard())){
 //                    throw new CustomException(bo.getRealname()+"身份证号码不一致");
@@ -937,13 +1025,33 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
                     }
                 }*/
                 UserSystemRegisterBo registerBo = BeanUtil.toBean(bo, UserSystemRegisterBo.class);
-                registerBo.setTel(bo.getTelphone());
+                String tel = "";
+                if (Validator.isNotEmpty(user1)){
+                    //手机号码存在,身份证不一致 (随机生成)
+                    tel = createTel();
+                    registerBo.setTel(tel);
+                }else {
+                    tel = bo.getTelphone();
+                    registerBo.setTel(tel);
+                }
+                if(Validator.isNotEmpty(bo.getSex())){
+                    if(bo.getSex().equals("男")){
+                        registerBo.setSexNum(1);
+                    }
+                    else if(bo.getSex().equals("女")){
+                        registerBo.setSexNum(2);
+                    }
+                }
+                if(Validator.isNotEmpty(bo.getEducation())){
+                    registerBo.setEduLevel(bo.getEducation());
+                }
                 registerBo.setIdcard(bo.getIdCard());
                 registerBo.setRegisterPlat("4");
                 Long userId = systemRegisterUser(registerBo);
                 if(userId.longValue()>0){
                     UserIdCardBatchVo user = BeanUtil.toBean(bo, UserIdCardBatchVo.class);
                     user.setUserId(userId);
+                    user.setTelphone(tel);
                     list1.add(user);
                     continue;
                 }
@@ -953,6 +1061,17 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         return list1;
     }
 
+    private String createTel() {
+        String mobile = TelPhoneUtils.createMobile();
+        int count = count(new LambdaQueryWrapper<User>()
+                .eq(User::getTelphone, EncryptHandler.encrypt(mobile)));
+        if (count > 0){
+            createTel();
+        }
+        return mobile;
+    }
+
+
     @Override
     public boolean editShareActivityCode(UserEditBo bo) {
         if (ObjectUtils.isNotNull(bo.getShareActivityCode())){
@@ -1037,6 +1156,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         });
     }
 
+
+
     private Long findSubjectId(String subject){
         if(subject!=null){
             String key = "SUB_"+subject;
@@ -1068,7 +1189,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         if(bo.getPwd()==null){
             throw new CustomException("密码不能为空");
         }
-        if(!ToolsUtils.verifPwd(bo.getPwd())){
+        if(!ToolsUtils.verifEasyPwd(bo.getPwd())){
             throw new CustomException("密码应由8-16位数字、大小写字母、符号组成");
         }
         String key = Constants.FORGET_SMS + bo.getTel();
@@ -1160,6 +1281,448 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         return this.updateById(update);
     }
 
+    @Override
+    public UserLiveAccountLoginVo liveUnifyLogin(UserLiveAccountLoginBo bo) {
+        if (bo.getType() != 1){
+            throw new CustomException("登录错误");
+        }
+        if(Validator.isEmpty(bo.getAccount())){
+            throw new CustomException("账号不能为空");
+        }
+
+        List<User> userList = baseMapper.getUserByTel(bo.getAccount());
+        if (CollectionUtils.isEmpty(userList)){
+            throw new CustomException("账号不存在!请检查");
+        }
+        //参数解析
+        String param = new String(Base64.decode(bo.getParam()));
+        if (StringUtils.isBlank(param)){
+            throw new CustomException("参数为空");
+        }
+
+        Map<String, String> split = Splitter.on("&").withKeyValueSeparator("=").split(param);
+        //商品ID
+        Long goodsId = Long.valueOf(split.get("gid"));
+        //观看权限
+        String per = split.get("watchPer");
+        //课程ID
+        String cid = split.get("cid");
+        //节ID
+        String sid = split.get("sid");
+
+        //获取对应商品
+        Goods goods = iGoodsService.getGoodsByIdNotTenant(goodsId);
+        User user = new User();
+        if (StringUtils.isNotBlank(per) && Integer.valueOf(per) == 2){
+            //所有人都可以看
+            user = userList.stream().filter(item -> {
+                Long tenantId = item.getTenantId();
+                Course course = iCourseService.getCourseByNotTenant(Long.valueOf(cid));
+                Long courseId = iCourseService.getCourseByTenantTwo(course.getCourseName(),course.getCode(),tenantId);
+                CourseSection section = iCourseSectionService.getSectionByNotTenant(Long.valueOf(sid));
+                CourseSection courseSection = iCourseSectionService.getSectionByTenantTwo(section.getName(),section.getCode(),tenantId);
+                Goods goodsTwo = iGoodsService.getGoodsByTenantTwo(goods.getGoodsName(),goods.getCode(),tenantId);
+                return ObjectUtils.isNotNull(courseId) && ObjectUtils.isNotNull(courseSection) && ObjectUtils.isNotNull(goodsTwo);
+            }).findFirst().orElse(null);
+
+        }else {
+            user = userList.stream().filter(item -> {
+                //判断用户是否购买商品
+                Long count = baseMapper.getUserOrderCount(item.getUserId(), item.getTenantId(), goods.getCode(), goods.getGoodsName());
+                return count > 0;
+            }).findFirst().orElse(null);
+        }
+
+        if(Validator.isEmpty(user)){
+            throw new CustomException("登录错误,请联系管理员!");
+        }
+        else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
+        {
+            throw new BaseException("对不起,您的账号:已停用");
+        }
+        String password = null;
+        if(bo.getPwd().length()>20){
+            String rsaPrivate = null;
+            try {
+                InputStream certStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("config/pri.key");
+                rsaPrivate = AES.getStringByInputStream_1(certStream);
+                certStream.close();
+                password = AES.decrypt(bo.getPwd(),rsaPrivate);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }else{
+            password = bo.getPwd();
+        }
+        if (!SecurityUtils.matchesPassword(password,user.getPassword()))
+        {
+            iUserLoginErrorService.saveErrorLog(bo.getAccount());
+            throw new BaseException("登录信息错误");
+        }
+        Long tenantId = user.getTenantId();
+        //组装跳转路径
+        SysTenant tenant = iSysTenantService.getById(tenantId);
+        String post = "";
+        String path = "";
+        switch (bo.getUrlType()){
+            case 1://H5
+                post = tenant.getHostH5();
+                path = "pages/webview/index";
+                break;
+            case 2://PC
+                post = tenant.getHostPc();
+                path = "living-room";
+                break;
+        }
+
+        Course course = iCourseService.getCourseByNotTenant(Long.valueOf(cid));
+        Long courseId = iCourseService.getCourseByTenantTwo(course.getCourseName(),course.getCode(),tenantId);
+        CourseSection section = iCourseSectionService.getSectionByNotTenant(Long.valueOf(sid));
+        CourseSection courseSection = iCourseSectionService.getSectionByTenantTwo(section.getName(),section.getCode(),tenantId);
+        Goods goodsTwo = iGoodsService.getGoodsByTenantTwo(goods.getGoodsName(),goods.getCode(),tenantId);
+
+        String url = "";
+        switch (bo.getUrlType()){
+            case 1://H5
+                String format1 = String.format("cid=%s&gid=%s&sid=%s&a=1", courseId, goodsTwo.getGoodsId(), courseSection.getSectionId());
+                String s1 = Base64.encode(format1);
+                url = String.format("%s/%s/%s?scene=%s",liveGotoURL, post,path, s1);
+                break;
+            case 2://Pc
+                String format = String.format("cid=%s&gid=%s&sid=%s", courseId, goodsTwo.getGoodsId(), courseSection.getSectionId());
+                String s = Base64.encode(format);
+                url = String.format("%s/%s/%s/%s?a=1&%s",liveGotoURL, post,path,courseSection.getLiveUrl(), s);
+                break;
+            default:
+                break;
+        }
+
+        UserLiveAccountLoginVo vo = new UserLiveAccountLoginVo();
+        vo.setTel(user.getTelphone());
+        vo.setUser_account(user.getUserAccount());
+        vo.setUrl(url);
+        vo.setTenantId(tenantId);
+        return vo;
+    }
+
+    @Override
+    public Map<String, Object> automaticAccountLogin(UserAppTelphoneLoginBo bo) {
+        User user = baseMapper.getUserByAccount(bo.getUserAccount());
+
+        if(Validator.isEmpty(user)){
+            throw new CustomException("该账号不存在");
+        }
+        ClientLoginUser loginUser = new ClientLoginUser();
+        loginUser.setUser(user);
+        Map<String,Object> map = new HashMap<>();
+        map.put(Constants.TOKEN,wxTokenService.createToken(loginUser));
+        map.put("user_account",user.getUserAccount());
+        map.put("full_info",Validator.isEmpty(user.getIdCard())?false:true); //是否完善身份信息
+        return map;
+    }
+
+    @Override
+    public UserLiveAccountLoginVo smsLiveUnifyLogin(UserLiveAccountLoginBo bo) {
+        if(bo.getTel()==null){
+            throw new CustomException("手机号不能为空");
+        }
+        String key = Constants.LOGIN_SMS + bo.getTel();
+        String code =  redisCache.getCacheObjectNoTenant(key);
+        if(code==null){
+            throw new CustomException("验证码错误");
+        }
+        if(!code.equals(bo.getCode())){
+            throw new CustomException("验证码错误");
+        }
+        redisCache.deleteObject(key);
+
+        if (bo.getType() != 1){
+            throw new CustomException("登录错误");
+        }
+
+        List<User> userList = baseMapper.getUserByTel(bo.getTel());
+        if (CollectionUtils.isEmpty(userList)){
+            throw new CustomException("请联系管理员!");
+        }
+        //参数解析
+        String param = new String(Base64.decode(bo.getParam()));
+        if (StringUtils.isBlank(param)){
+            throw new CustomException("参数为空");
+        }
+
+        Map<String, String> split = Splitter.on("&").withKeyValueSeparator("=").split(param);
+        //商品ID
+        Long goodsId = Long.valueOf(split.get("gid"));
+        //观看权限
+        String per = split.get("watchPer");
+        //课程ID
+        String cid = split.get("cid");
+        //节ID
+        String sid = split.get("sid");
+        //获取对应商品
+        Goods goods = iGoodsService.getGoodsByIdNotTenant(goodsId);
+        User user = new User();
+        if (StringUtils.isNotBlank(per) && Integer.valueOf(per) == 2){
+            //所有人都可以看
+            user = userList.stream().filter(item -> {
+                Long tenantId = item.getTenantId();
+                Course course = iCourseService.getCourseByNotTenant(Long.valueOf(cid));
+                Long courseId = iCourseService.getCourseByTenantTwo(course.getCourseName(),course.getCode(),tenantId);
+                CourseSection section = iCourseSectionService.getSectionByNotTenant(Long.valueOf(sid));
+                CourseSection courseSection = iCourseSectionService.getSectionByTenantTwo(section.getName(),section.getCode(),tenantId);
+                Goods goodsTwo = iGoodsService.getGoodsByTenantTwo(goods.getGoodsName(),goods.getCode(),tenantId);
+                return ObjectUtils.isNotNull(courseId) && ObjectUtils.isNotNull(courseSection) && ObjectUtils.isNotNull(goodsTwo);
+            }).findFirst().orElse(null);
+
+        }else {
+            user = userList.stream().filter(item -> {
+                //判断用户是否购买商品
+                Long count = baseMapper.getUserOrderCount(item.getUserId(), item.getTenantId(), goods.getCode(), goods.getGoodsName());
+                return count > 0;
+            }).findFirst().orElse(null);
+        }
+
+        if(Validator.isEmpty(user)){
+            throw new CustomException("登录错误,请联系管理员!");
+        }
+        else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
+        {
+            throw new BaseException("对不起,您的账号:已停用");
+        }
+
+        Long tenantId = user.getTenantId();
+        //组装跳转路径
+        SysTenant tenant = iSysTenantService.getById(tenantId);
+        String post = "";
+        String path = "";
+        switch (bo.getUrlType()){
+            case 1://H5
+                post = tenant.getHostH5();
+                path = "pages/webview/index";
+                break;
+            case 2://PC
+                post = tenant.getHostPc();
+                path = "living-room";
+                break;
+        }
+        Course course = iCourseService.getCourseByNotTenant(Long.valueOf(cid));
+        Long courseId = iCourseService.getCourseByTenantTwo(course.getCourseName(),course.getCode(),tenantId);
+        CourseSection section = iCourseSectionService.getSectionByNotTenant(Long.valueOf(sid));
+        CourseSection courseSection = iCourseSectionService.getSectionByTenantTwo(section.getName(),section.getCode(),tenantId);
+        Goods goodsTwo = iGoodsService.getGoodsByTenantTwo(goods.getGoodsName(),goods.getCode(),tenantId);
+
+        String url = "";
+        switch (bo.getUrlType()){
+            case 1://H5
+                String format1 = String.format("cid=%s&gid=%s&sid=%s&a=1", courseId, goodsTwo.getGoodsId(), courseSection.getSectionId());
+                String s1 = Base64.encode(format1);
+                url = String.format("%s/%s/%s?scene=%s",liveGotoURL, post,path, s1);
+                break;
+            case 2://Pc
+                String format = String.format("cid=%s&gid=%s&sid=%s", courseId, goodsTwo.getGoodsId(), courseSection.getSectionId());
+                String s = Base64.encode(format);
+                url = String.format("%s/%s/%s/%s?a=1&%s",liveGotoURL, post,path,courseSection.getLiveUrl(), s);
+                break;
+            default:
+                break;
+        }
+
+        UserLiveAccountLoginVo vo = new UserLiveAccountLoginVo();
+        vo.setTel(user.getTelphone());
+        vo.setUser_account(user.getUserAccount());
+        vo.setUrl(url);
+        vo.setTenantId(tenantId);
+        return vo;
+    }
+
+    @Override
+    public UserLiveAccountLoginVo liveUnifyLoginRefresh(UserLiveAccountLoginBo bo) {
+        if(Validator.isEmpty(bo.getUser_account())){
+            throw new CustomException("账号不能为空");
+        }
+
+        User user = baseMapper.getUserByAccount(bo.getUser_account());
+        if(Validator.isEmpty(user)){
+            throw new CustomException("登录信息错误");
+        }
+        else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
+        {
+            throw new BaseException("对不起,您的账号:已停用");
+        }
+        //参数解析
+        String param = new String(Base64.decode(bo.getParam()));
+        if (StringUtils.isBlank(param)){
+            throw new CustomException("参数为空");
+        }
+
+        Map<String, String> split = Splitter.on("&").withKeyValueSeparator("=").split(param);
+        Long goodsId = Long.valueOf(split.get("gid"));
+        Long tenantId = user.getTenantId();
+
+        //获取对应商品
+        Goods goods = iGoodsService.queryGoodsByIdTenant(goodsId,tenantId);
+        if (ObjectUtils.isNull(goods)){
+            throw new CustomException("账号不匹配,请重新登录!");
+        }
+
+        //组装跳转路径
+        SysTenant tenant = iSysTenantService.getById(tenantId);
+        String post = "";
+        String path = "";
+        switch (bo.getUrlType()){
+            case 1://H5
+                post = tenant.getHostH5();
+                path = "pages/webview/index";
+                break;
+            case 2://PC
+                post = tenant.getHostPc();
+                path = "living-room";
+                break;
+        }
+
+        String cid = split.get("cid");
+        String sid = split.get("sid");
+        Course course = iCourseService.getCourseByNotTenant(Long.valueOf(cid));
+        Long courseId = iCourseService.getCourseByTenantTwo(course.getCourseName(),course.getCode(),tenantId);
+        CourseSection section = iCourseSectionService.getSectionByNotTenant(Long.valueOf(sid));
+        CourseSection courseSection = iCourseSectionService.getSectionByTenantTwo(section.getName(),section.getCode(),tenantId);
+        Goods goodsTwo = iGoodsService.getGoodsByTenantTwo(goods.getGoodsName(),goods.getCode(),tenantId);
+
+        String url = "";
+        switch (bo.getUrlType()){
+            case 1://H5
+                String format1 = String.format("cid=%s&gid=%s&sid=%s&a=1", courseId, goodsTwo.getGoodsId(), courseSection.getSectionId());
+                String s1 = Base64.encode(format1);
+                url = String.format("%s/%s/%s?scene=%s",liveGotoURL, post,path, s1);
+                break;
+            case 2://Pc
+                String format = String.format("cid=%s&gid=%s&sid=%s", courseId, goodsTwo.getGoodsId(), courseSection.getSectionId());
+                String s = Base64.encode(format);
+                url = String.format("%s/%s/%s/%s?a=1&%s",liveGotoURL, post,path,courseSection.getLiveUrl(), s);
+                break;
+            default:
+                break;
+        }
+
+        UserLiveAccountLoginVo vo = new UserLiveAccountLoginVo();
+        vo.setTel(user.getTelphone());
+        vo.setUser_account(user.getUserAccount());
+        vo.setUrl(url);
+        vo.setTenantId(tenantId);
+        return vo;
+    }
+
+    @Override
+    public List<User> listByIdsNotTenant(List<Long> userIds) {
+        return baseMapper.listByIdsNotTenant(userIds);
+    }
+
+    @Override
+    public String createToken(LoginUser loginUser) {
+        return tokenService.createToken(loginUser);
+    }
+
+    @Override
+    public User getByIdNoTenant(Long userId) {
+        return baseMapper.getByIdNoTenant(userId);
+    }
+
+    @Override
+    public User getByCardNoTenant(String idCard) {
+        return baseMapper.getByCardNoTenant(idCard);
+    }
+
+    @Override
+    public Map<String, Object> importSevenUser(List<UserPeriodImportBo> userList) {
+        if (CollectionUtils.isEmpty(userList)) {
+            throw new IllegalArgumentException("请勿导入空表格");
+        }
+        List<UserPeriodImportBo> errorList = new ArrayList<>();
+        List<UserPeriodImportBo> successList = new ArrayList<>();
+        String importNo = ServletUtils.getEncoded("IMPORT");
+        for (UserPeriodImportBo itemImport : userList) {
+            if(Validator.isEmpty(itemImport.getUserPhone())||itemImport.getUserPhone().length()!=11){
+                itemImport.setCause("手机号不能为空或者格式不对");
+                errorList.add(itemImport);
+                continue;
+            }
+            if(Validator.isEmpty(itemImport.getUserCard())){
+                itemImport.setCause("身份证不能为空");
+                errorList.add(itemImport);
+                continue;
+            }
+            if(Validator.isEmpty(itemImport.getUserName())){
+                itemImport.setCause("真实姓名不能为空");
+                errorList.add(itemImport);
+                continue;
+            }
+            User user = getOne(new LambdaQueryWrapper<User>()
+                    .eq(User::getTelphone,EncryptHandler.encrypt(itemImport.getUserPhone())).last("limit 1"));
+            if(Validator.isNotNull(user)){
+                if(Validator.isNotEmpty(user.getIdCard())&&Validator.isNotEmpty(itemImport.getUserCard())&&!itemImport.getUserCard().equals(user.getIdCard())){
+                    throw new CustomException(itemImport.getUserCard()+"身份证号码不一致");
+                }
+                if(Validator.isEmpty(user.getIdCard())){
+                    //更新身份证和姓名
+                    user.setIdCard(itemImport.getUserCard());
+                    user.setRealname(itemImport.getUserName());
+                    updateById(user);
+                }
+                //手机号已存在
+                itemImport.setUserId(user.getUserId());
+                itemImport.setStudentCode(user.getUserAccount());
+                itemImport.setUserName(user.getRealname());
+                itemImport.setUserCard(user.getIdCard());
+                successList.add(itemImport);
+                continue;
+            }else{
+                User user2 = getOne(new LambdaQueryWrapper<User>()
+                        .eq(User::getIdCard,EncryptHandler.encrypt(itemImport.getUserCard())).last("limit 1"));
+                if(Validator.isNotEmpty(user2)){
+                    throw new CustomException(itemImport.getUserName()+"身份证号码已存在,创建失败");
+                }
+            }
+            User inertData = new User();
+            inertData.setTelphone(itemImport.getUserPhone());
+            //隐藏手机号作为初始昵称
+            inertData.setNickname(TelPhoneUtils.hideTelPhone(itemImport.getUserPhone()));
+            //雪花算法产生账号ID
+            SnowflakeIdUtils idWorker = new SnowflakeIdUtils(3, 1);
+            inertData.setUserAccount(String.valueOf(idWorker.nextId()));
+            inertData.setSex(1);
+            if(Validator.isNotEmpty(itemImport.getSex())){
+                inertData.setSex(itemImport.getSex().equals("女")?2:1);
+            }
+            if(Validator.isNotEmpty(itemImport.getEducation())){
+                inertData.setEduLevel(itemImport.getEducation());
+            }
+            inertData.setIdCard(itemImport.getUserCard());
+            inertData.setRealname(itemImport.getUserName());
+            inertData.setStatus(1);
+            inertData.setRegisterPlat("3");
+            inertData.setAvatar(Constants.DEFAULT_AVATAR);
+            inertData.setLastLoginIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
+            inertData.setLastLoginTime(DateUtils.getNowTime());
+            inertData.setCreateTime(DateUtils.getNowTime());
+            inertData.setUpdateTime(DateUtils.getNowTime());
+            //初始密码(身份证后6位)
+            String idCard = itemImport.getUserCard();
+            String pwd =  idCard.substring(idCard.length() - 6); // 随机密码
+            inertData.setPassword(SecurityUtils.encryptPassword(pwd));
+            inertData.setImportNo(importNo); //设置导入编号 一个导入页面同时导入多次算一个编号
+            if(!save(inertData)){
+                itemImport.setCause("注册失败");
+                errorList.add(itemImport);
+                continue;
+            }
+            itemImport.setUserId(inertData.getUserId());
+            itemImport.setImportNo(importNo);
+            itemImport.setStudentCode(inertData.getUserAccount());
+            successList.add(itemImport);
+        }
+        return null;
+    }
+
     @Override
     public Map<String, Object> accountLogin(UserAppAccountLoginBo bo) {
         if(Validator.isEmpty(bo.getAccount())){
@@ -1184,13 +1747,29 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
                 .or()
                 .eq(User::getIdCard,EncryptHandler.encrypt(bo.getAccount())));
         User user = getOne(queryWrapper);
+        String tenantId = ServletUtils.getRequest().getHeader("TenantId");
+        Integer share = 0;
+        if (StringUtils.isNotBlank(tenantId) && "867735392558919680".equals(tenantId)){
+            share = 1;
+        }
+
         if(Validator.isEmpty(user)){
             iUserLoginErrorService.saveErrorLog(bo.getAccount());
-            throw new CustomException("登录信息错误");
+            //判断旧系统是否有账号
+            if (share > 0){
+                oldAccountLogin(bo,1);
+            }else {
+                throw new CustomException("登录信息错误");
+            }
         }
         else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
         {
-            throw new BaseException("对不起,您的账号:已停用");
+            //判断旧系统是否有账号
+            if (share > 0){
+                oldAccountLogin(bo,1);
+            }else {
+                throw new CustomException("对不起,您的账号:已停用");
+            }
         }
         String password = null;
         if(bo.getPwd().length()>20){
@@ -1209,7 +1788,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         if (!SecurityUtils.matchesPassword(password,user.getPassword()))
         {
             iUserLoginErrorService.saveErrorLog(bo.getAccount());
-            throw new BaseException("登录信息错误");
+            //判断旧系统是否有账号
+            if (share > 0){
+                oldAccountLogin(bo,1);
+            }else {
+                throw new CustomException("登录信息错误");
+            }
         }
         //如果活动分销码变动
         if (StringUtils.isNotBlank(bo.getShareActivityCode())){
@@ -1225,6 +1809,58 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
         return map;
     }
 
+    private void oldAccountLogin(UserAppAccountLoginBo bo,Integer type) {
+        String msg = type == 1?"登录信息错误":"对不起,您的账号:已停用";
+        Boolean codeFlag = true;
+        Map<String, String> params = new HashMap<>();
+        Long nowTime = DateUtils.getNowTime();
+        String sign = ToolsUtils.EncoderByMd5(bo.getAccount()+bo.getAccount()+nowTime + "pubilc2022");
+        params.put("stamp", nowTime.toString());
+        params.put("sign", sign);
+        params.put("idNum", bo.getAccount());
+        params.put("passwordSign", "1");
+        params.put("telphone",bo.getAccount());
+        String password = null;
+        if(bo.getPwd().length()>20){
+            String rsaPrivate = null;
+            try {
+                InputStream certStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("config/pri.key");
+                rsaPrivate = AES.getStringByInputStream_1(certStream);
+                certStream.close();
+                password = AES.decrypt(bo.getPwd(),rsaPrivate);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }else{
+            password = bo.getPwd();
+        }
+        params.put("password", password);
+        String respone = "";
+        try {
+            respone = HttpUtils.postFormBody(OLD_GOODS, params);
+            if (!respone.contains("\"code\":200")) {
+                codeFlag = false;
+                throw new CustomException("登录信息错误");
+            }
+            JSONObject jsonObject = JSONObject.parseObject(respone);
+            Object data = jsonObject.get("data");
+            if (ObjectUtils.isNotNull(data)){
+                UserNewGoodsVo vo = JSONObject.parseObject(JSONObject.toJSONString(data), UserNewGoodsVo.class);
+                throw new CustomException(vo.getPcUrl());
+            }else {
+                codeFlag = false;
+                throw new CustomException(msg);
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+            if (codeFlag){
+                throw new CustomException(e.getMessage(),699);
+            }else {
+                throw new CustomException(e.getMessage());
+            }
+        }
+    }
+
     @Override
     public Boolean bindIdCard(UserAppBindIdBo bo) {
         if(Validator.isEmpty(bo.getIdCard())){

+ 146 - 1
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/WxLoginService.java

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
@@ -29,7 +30,10 @@ import com.zhongzheng.modules.distribution.vo.SellerWxVo;
 import com.zhongzheng.modules.goods.domain.Goods;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
+import com.zhongzheng.modules.grade.domain.ClassGradeUser;
+import com.zhongzheng.modules.system.domain.SysTenant;
 import com.zhongzheng.modules.system.service.ISysConfigService;
+import com.zhongzheng.modules.system.service.ISysTenantService;
 import com.zhongzheng.modules.user.bo.UserWxFollowAddBo;
 import com.zhongzheng.modules.user.domain.User;
 import com.zhongzheng.modules.user.entity.ClientLoginUser;
@@ -162,6 +166,9 @@ public class WxLoginService implements IWxLoginService {
     @Autowired
     private IDistributionSellerService iDistributionSellerService;
 
+    @Autowired
+    private ISysTenantService iSysTenantService;
+
     private final String KEY_PREFIX = "GOODS_SHARE";
 
     public void initData(){
@@ -270,6 +277,41 @@ public class WxLoginService implements IWxLoginService {
         return map;
     }
 
+    @Transactional(rollbackFor = Exception.class)
+    public Map<String, Object> openIdLogin(WxLoginBody loginBody) {
+        if(Validator.isEmpty(loginBody.getOpenId())){
+            throw new CustomException("openid缺失");
+        }
+        User user = iUserService.getOne(new LambdaQueryWrapper<User>().eq(User::getOpenId, loginBody.getOpenId()).last("limit 1"));
+        if (ObjectUtils.isNull(user)&&Validator.isEmpty(loginBody.getUserId())) {
+            throw new CustomException("该openid暂无绑定!",666);
+        }
+        if (Validator.isNotEmpty(loginBody.getUserId())) {
+            user = iUserService.getOne(new LambdaQueryWrapper<User>().eq(User::getUserId, loginBody.getUserId()).last("limit 1"));
+            if(Validator.isNotEmpty(user.getOpenId())){
+                throw new CustomException("该用户已绑定过openid!",667);
+            }
+            user.setOpenId(loginBody.getOpenId());
+            if(Validator.isNotEmpty(loginBody.getUnionId())){
+                user.setUnionId(loginBody.getUnionId());
+            }
+            iUserService.updateById(user);
+        }
+
+        //如果活动分销码变动
+        if (StringUtils.isNotBlank(loginBody.getShareActivityCode())){
+            user.setShareActivityCode(loginBody.getShareActivityCode());
+            iUserService.updateById(user);
+        }
+        ClientLoginUser loginUser = new ClientLoginUser();
+        loginUser.setUser(user);
+        Map<String, Object> map = new HashMap<>();
+        map.put(Constants.TOKEN, wxTokenService.createToken(loginUser));
+        map.put("user_account", loginUser.getUser().getUserAccount());
+        map.put("full_info", Validator.isEmpty(user.getIdCard()) ? false : true); //是否完善身份信息
+        return map;
+    }
+
 
     public Map<String, String> smallTel(WxLoginBody loginBody) {
         initData();
@@ -384,6 +426,30 @@ public class WxLoginService implements IWxLoginService {
         return openId;
     }
 
+    public Map<String,String> getExamWxOpenId(WxLoginBody loginBody) {
+        if(Validator.isEmpty(loginBody.getCode())){
+            throw new CustomException("code缺失");
+        }
+        initData();
+        String openId;
+
+        //每次更新最新openid
+        String param = String.format(wxAuthParam, appid, appsrcret, loginBody.getCode());
+        String resultString = HttpUtils.sendGet(wxAuthUrl, param);
+        //解析json
+        JSONObject jsonObject = (JSONObject) JSONObject.parse(resultString);
+        String session_key = String.valueOf(jsonObject.get("session_key"));
+        openId = String.valueOf(jsonObject.get("openid"));
+        String unionId = null;
+        if (jsonObject.containsKey("unionid")) { //当没绑定开放平台
+            unionId = String.valueOf(jsonObject.get("unionid"));
+        }
+        Map<String,String> map = new HashMap();
+        map.put("openId",openId);
+        map.put("unionId",unionId);
+        return map;
+    }
+
 
     //小程序获取用户信息
     public User getWxUnionIdUser(WxLoginBody loginBody) {
@@ -1155,8 +1221,18 @@ public class WxLoginService implements IWxLoginService {
             }
         }
         JSONObject jsonObject = JSONObject.parseObject(result);
+        if(jsonObject.containsKey("url_link")){
+            return jsonObject.get("url_link").toString();
+        }else{
+            String tenantId = ServletUtils.getRequest().getHeader("TenantId");
+            SysTenant sysTenant = iSysTenantService.getOne(new LambdaQueryWrapper<SysTenant>()
+                    .eq(SysTenant::getTenantId,tenantId).last("limit 1"));
+            if(Validator.isNotEmpty(sysTenant)){
+                return "https://"+sysTenant.getHostH5();
+            }
+            return null;
+        }
 
-        return jsonObject.get("url_link").toString();
     }
 
     @Override
@@ -1271,12 +1347,81 @@ public class WxLoginService implements IWxLoginService {
         }
         return user;
     }
+
+    //获取公众号openid
+    public String bindGzhUnionIdUser(WxLoginBody loginBody) {
+        if(Validator.isEmpty(loginBody.getCode())){
+            throw new CustomException("code不能为空");
+        }
+        initData();
+        String param = String.format(gzh_wxAuthParam, gzh_appid, gzh_appsrcret, loginBody.getCode());
+        String resultString = HttpUtils.sendGet(gzh_wxAuthUrl, param);
+        //解析json
+        JSONObject jsonObject = (JSONObject) JSONObject.parse(resultString);
+        String access_token = String.valueOf(jsonObject.get("access_token"));
+        if(access_token.equals("null")){
+            throw new CustomException( String.valueOf(jsonObject.get("errmsg")));
+        }
+        String openId = String.valueOf(jsonObject.get("openid"));
+
+        String userInfoParam = String.format(gzh_wxUserInfoParam, access_token, openId);
+        String userInfoResultString = HttpUtils.sendGet(gzh_wxUserInfoUrl, userInfoParam);
+
+        //解析json
+        JSONObject jsonObject1 = (JSONObject) JSONObject.parse(userInfoResultString);
+        return openId;
+    }
+
+    public Boolean checkBindOpenId(WxIdBody loginBody) {
+        if(Validator.isEmpty(loginBody.getOpenid())||Validator.isEmpty(loginBody.getFromPlat())){
+            throw new CustomException("参数缺失");
+        }
+        User user = iUserService.getOne(new LambdaQueryWrapper<User>().eq(User::getUserId,loginBody.getUserId()));
+        if(loginBody.getFromPlat()==1){
+            if(Validator.isEmpty(user.getGzhOpenId())){
+                LambdaUpdateWrapper<User> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+                objectLambdaUpdateWrapper.eq(User::getUserId, loginBody.getUserId());
+                objectLambdaUpdateWrapper.set(User::getGzhOpenId, loginBody.getOpenid());
+                objectLambdaUpdateWrapper.set(User::getUpdateTime, DateUtils.getNowTime());
+                iUserService.update(null, objectLambdaUpdateWrapper);
+                return true;
+            }else{
+                if(user.getGzhOpenId().equals(loginBody.getOpenid())){
+                    return true;
+                }else{
+                    return false;
+                }
+            }
+        }
+        else if(loginBody.getFromPlat()==2){
+            if(Validator.isEmpty(user.getOpenId())){
+                LambdaUpdateWrapper<User> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+                objectLambdaUpdateWrapper.eq(User::getUserId, loginBody.getUserId());
+                objectLambdaUpdateWrapper.set(User::getOpenId, loginBody.getOpenid());
+                objectLambdaUpdateWrapper.set(User::getUpdateTime, DateUtils.getNowTime());
+                iUserService.update(null, objectLambdaUpdateWrapper);
+                return true;
+            }else{
+                if(user.getOpenId().equals(loginBody.getOpenid())){
+                    return true;
+                }else{
+                    return false;
+                }
+            }
+        }
+        return false;
+    }
+
     public DistributionSeller bindWxGzhOpenIdSeller(WxLoginBody loginBody) {
         DistributionSeller seller = iDistributionSellerService.getOne(new LambdaQueryWrapper<DistributionSeller>().eq(DistributionSeller::getSellerId,loginBody.getSellerId()));
         if (seller == null) {
             throw new CustomException("您尚未注册,请前往小程序注册");
         }
         if(Validator.isNotEmpty(loginBody.getGzhOpenid())){
+            DistributionSeller seller2 = iDistributionSellerService.getOne(new LambdaQueryWrapper<DistributionSeller>().ne(DistributionSeller::getSellerId,loginBody.getSellerId()).eq(DistributionSeller::getGzhOpenId,loginBody.getGzhOpenid()));
+            if (Validator.isNotEmpty(seller2)) {
+                throw new CustomException("该微信已绑定其他用户");
+            }
             seller.setGzhOpenId(loginBody.getGzhOpenid());
         }
         if(Validator.isNotEmpty(loginBody.getUnionId())){

+ 23 - 14
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/WxTokenService.java

@@ -5,18 +5,14 @@ import cn.hutool.core.util.IdUtil;
 import cn.hutool.http.useragent.UserAgent;
 import cn.hutool.http.useragent.UserAgentUtil;
 import com.zhongzheng.common.constant.Constants;
-import com.zhongzheng.common.core.domain.model.LoginUser;
-import com.zhongzheng.common.exception.CustomException;
-import com.zhongzheng.common.exception.user.UserPasswordNotMatchException;
-import com.zhongzheng.common.utils.MessageUtils;
-import com.zhongzheng.framework.manager.AsyncManager;
-import com.zhongzheng.framework.manager.factory.AsyncFactory;
-import com.zhongzheng.modules.user.domain.User;
-import com.zhongzheng.modules.user.entity.ClientLoginUser;
 import com.zhongzheng.common.core.redis.RedisCache;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.ip.AddressUtils;
 import com.zhongzheng.common.utils.ip.IpUtils;
+import com.zhongzheng.modules.user.bo.UserLoginKeyAddBo;
+import com.zhongzheng.modules.user.domain.User;
+import com.zhongzheng.modules.user.entity.ClientLoginUser;
+import com.zhongzheng.modules.user.service.IUserLoginKeyService;
 import com.zhongzheng.modules.user.service.IUserService;
 import io.jsonwebtoken.Claims;
 import io.jsonwebtoken.Jwts;
@@ -24,9 +20,6 @@ import io.jsonwebtoken.SignatureAlgorithm;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.security.authentication.AuthenticationManager;
-import org.springframework.security.authentication.BadCredentialsException;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.Authentication;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
@@ -67,6 +60,9 @@ public class WxTokenService
     @Autowired
     private IUserService iUserService;
 
+    @Autowired
+    private IUserLoginKeyService iUserLoginKeyService;
+
     @Resource
     private AuthenticationManager authenticationManager;
 
@@ -75,8 +71,7 @@ public class WxTokenService
      *
      * @return 用户信息
      */
-    public ClientLoginUser getLoginUser(HttpServletRequest request)
-    {
+    public ClientLoginUser getLoginUser(HttpServletRequest request) {
         //测试用户
         String test_token = request.getHeader("X-Auth-Token");
         if("test".equals(test_token)){
@@ -89,6 +84,10 @@ public class WxTokenService
             Claims claims = parseToken(token);
             // 解析对应的权限以及用户信息
             String uuid = (String) claims.get(Constants.WX_LOGIN_USER_KEY);
+            if(!iUserLoginKeyService.queryByUserKey(uuid)){
+                ClientLoginUser errorUser =  new ClientLoginUser();
+                return errorUser;
+            }
             String userKey = getTokenKey(uuid);
             ClientLoginUser user = redisCache.getCacheObject(userKey);
             return user;
@@ -142,7 +141,17 @@ public class WxTokenService
         refreshToken(loginUser);
         Map<String, Object> claims = new HashMap<>();
         claims.put(Constants.WX_LOGIN_USER_KEY, token);
-        return createToken(claims);
+        String secret = createToken(claims);
+        if(Validator.isNotEmpty(token)){
+            UserLoginKeyAddBo addBo = new UserLoginKeyAddBo();
+            addBo.setUserId(loginUser.getUser().getUserId());
+            addBo.setUserKey(token);
+            addBo.setIp(loginUser.getIpaddr());
+            addBo.setBrowser(loginUser.getBrowser());
+            addBo.setSecret(secret);
+            iUserLoginKeyService.insertByAddBo(addBo);
+        }
+        return secret;
     }
 
     /**

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/bo/ActivityRecommendQueryBo.java

@@ -6,6 +6,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 import java.util.HashMap;
 
@@ -57,4 +58,6 @@ public class ActivityRecommendQueryBo extends BaseEntity {
 	/** 1小程序 2PC网站 */
 	@ApiModelProperty("1小程序 2PC网站")
 	private Integer platform;
+	@ApiModelProperty("1有效 0无效")
+	private List<Integer> statusList;
 }

+ 2 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/service/impl/ActivityGoodsPriceServiceImpl.java

@@ -1,6 +1,6 @@
 package com.zhongzheng.modules.activity.service.impl;
 
-import com.baomidou.dynamic.datasource.annotation.DS;
+
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.zhongzheng.modules.activity.domain.ActivityGoodsPrice;
 import com.zhongzheng.modules.activity.mapper.ActivityGoodsPriceMapper;
@@ -18,10 +18,9 @@ import java.util.List;
  * @date 2022-04-13
  */
 @Service
-@DS("slave")
 public class ActivityGoodsPriceServiceImpl extends ServiceImpl<ActivityGoodsPriceMapper, ActivityGoodsPrice> implements IActivityGoodsPriceService {
     @Override
-    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
+    
     public void saveBatchEntity(List<ActivityGoodsPrice> priceList) {
         saveBatch(priceList);
     }

+ 12 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/service/impl/ActivityRecommendServiceImpl.java

@@ -140,6 +140,18 @@ public class ActivityRecommendServiceImpl extends ServiceImpl<ActivityRecommendM
                             GoodsSpecAttributeRelation relation = list.stream().findFirst().get();
                             item.setSpecTemplateId(relation.getSpecTemplateId());
                         }
+                        //多规格下的价格区间
+                        List<GoodsSpecAttributeRelation> specAttributeRelations = goodsSpecAttributeRelationService
+                                .list(new LambdaQueryWrapper<GoodsSpecAttributeRelation>()
+                                        .eq(GoodsSpecAttributeRelation::getSpecTemplateId, item.getSpecTemplateId()));
+                        if (CollectionUtils.isNotEmpty(specAttributeRelations)) {
+                            List<Long> goodsIds = specAttributeRelations.stream().filter(x -> ObjectUtils.isNotNull(x.getGoodsId())).map(GoodsSpecAttributeRelation::getGoodsId).collect(Collectors.toList());
+                            List<Goods> goodsList = iGoodsService.listByIds(goodsIds);
+                            //从小到大排序
+                            List<Goods> collect = goodsList.stream().filter(x -> ObjectUtils.isNotNull(x.getStandPrice())).sorted(Comparator.comparing(Goods::getStandPrice)).collect(Collectors.toList());
+                            item.setMinPrice(collect.get(0).getStandPrice());
+                            item.setMaxPrice(collect.get(collect.size() - 1).getStandPrice());
+                        }
                     }
                 });
             }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/vo/ActivityRecommendVo.java

@@ -71,4 +71,6 @@ public class ActivityRecommendVo {
 	private String businessName;
 	@ApiModelProperty("商品列表")
 	private List<ActivityRecommendGoodsVo> goodsList;
+	@ApiModelProperty("业务别名称")
+	private String aliasName;
 }

+ 4 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/bo/OssRequest.java

@@ -20,7 +20,7 @@ import javax.validation.constraints.NotNull;
 public class OssRequest{
 
     /** 上传图片标识 */
-    @ApiModelProperty(value = "上传图片标识 0头像 1身份证 2题库 3指南指引图片 4广告图片 5身份证或学信网图片 6文件excel,word,zip等",required = true)
+    @ApiModelProperty(value = "上传图片标识 0头像 1身份证 2题库 3指南指引图片 4广告图片 5身份证或学信网图片 6文件excel,word,zip等 10文件zip",required = true)
     @NotNull(message = "上传图片标识不能为空")
     private Integer ImageStatus;
 
@@ -33,4 +33,7 @@ public class OssRequest{
 
     @ApiModelProperty("班级ID")
     private Long gradeId;
+
+    @ApiModelProperty("图片路径")
+    private String path;
 }

+ 12 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/OssService.java

@@ -6,6 +6,7 @@ import com.zhongzheng.modules.alioss.bo.OssRequest;
 import com.zhongzheng.modules.alioss.vo.FileBean;
 import com.zhongzheng.modules.alioss.vo.ResultBean;
 import com.zhongzheng.modules.grade.vo.ClassPeriodStudentExportVo;
+import com.zhongzheng.modules.grade.vo.WeekDataVo;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
@@ -22,6 +23,10 @@ public interface OssService {
 
     String upload(OssRequest base) throws Exception;
 
+    String uploadWithPath(OssRequest base,String path) throws Exception;
+
+    String uploadWithUrl(OssRequest base,String urlString);
+
     String uploadInputStream(InputStream inputStream,Integer imageStatus) throws Exception;
 
     String uploadBase64(String fileStr,OssRequest ossRequest);
@@ -30,7 +35,14 @@ public interface OssService {
 
     void zipPeopleDownload(ClassPeriodStudentExportVo vo, ZipOutputStream outStream);
 
+    void zipPeopleWeekDownload(ClassPeriodStudentExportVo vo, ZipOutputStream outStream, WeekDataVo weekDataVo);
+
     void zipCommonDownload(List<String> fileList, ZipOutputStream zipOut, String dir);
 
     void zipWisdomDownload(List<FileBean> list, ZipOutputStream outStream);
+
+    InputStream getStreamByObject(String filePath) throws Exception;
+
+    void processObject(String targetImage ,String sourceImage,String styleType) ;
+
 }

+ 114 - 18
zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/impl/OssServiceImpl.java

@@ -3,14 +3,11 @@ package com.zhongzheng.modules.alioss.service.impl;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
-
-import com.aliyun.oss.OSS;
 import com.aliyun.oss.OSSClient;
+import com.aliyun.oss.OSSException;
 import com.aliyun.oss.common.utils.BinaryUtil;
-import com.aliyun.oss.internal.OSSUtils;
+import com.aliyun.oss.common.utils.IOUtils;
 import com.aliyun.oss.model.*;
-import com.zhongzheng.common.constant.Constants;
-import com.zhongzheng.common.core.domain.AjaxResult;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.modules.alioss.bo.OssCallbackParam;
 import com.zhongzheng.modules.alioss.bo.OssRequest;
@@ -18,33 +15,29 @@ import com.zhongzheng.modules.alioss.service.OssService;
 import com.zhongzheng.modules.alioss.vo.FileBean;
 import com.zhongzheng.modules.alioss.vo.ResultBean;
 import com.zhongzheng.modules.grade.vo.ClassPeriodStudentExportVo;
+import com.zhongzheng.modules.grade.vo.WeekDataVo;
 import com.zhongzheng.modules.user.service.IUserStudyRecordPhotoService;
-import org.apache.commons.io.IOUtils;
-import org.apache.xmlbeans.impl.values.XmlValueNotNillableException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
-import org.springframework.util.Base64Utils;
 import org.springframework.util.CollectionUtils;
-import org.springframework.web.multipart.MultipartFile;
 import sun.misc.BASE64Decoder;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.sql.rowset.serial.SerialBlob;
 import javax.sql.rowset.serial.SerialException;
-import java.awt.*;
-import java.io.*;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLConnection;
 import java.sql.SQLException;
 import java.text.SimpleDateFormat;
 import java.util.*;
-import java.util.List;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
-import static jdk.nashorn.internal.objects.NativeError.getFileName;
-
 @Service
 public class OssServiceImpl implements OssService {
     private static final Logger LOGGER = LoggerFactory.getLogger(OssServiceImpl.class);
@@ -217,6 +210,12 @@ public class OssServiceImpl implements OssService {
             case 9:
                 RandomFilename = "wisdom" + "/" + prefixName + (Validator.isNotEmpty(prefixName) ? "" : (sdf.format(new Date()))) + "/" + now+ String.valueOf(random > 0 ? random : (-1) * random);
                 break;
+            case 10:
+                RandomFilename = "file" + "/" +(sdf.format(new Date())) + "/" + now + ".zip";
+                break;
+            case 11:
+                RandomFilename = "file/pdf/" +(sdf.format(new Date())) + "/" + now + ".pdf";
+                break;
         }
 
         return RandomFilename;
@@ -244,6 +243,7 @@ public class OssServiceImpl implements OssService {
             String suffix = originalFilename.substring(originalFilename.lastIndexOf(".") + 1);
 
             String fileName = ALIYUN_OSS_DIR_PREFIX + generateRandomFilename(file) + "." + suffix;
+//            String fileName = ALIYUN_OSS_DIR_PREFIX + generateRandomFilename(file) ;
 
             //调用oss方法实现上传
             //第一个参数  Bucket名称
@@ -259,6 +259,51 @@ public class OssServiceImpl implements OssService {
         }
     }
 
+    @Override
+    public String uploadWithPath(OssRequest base, String path) throws Exception {
+        try {
+            //获取上传文件输入流
+            InputStream inputStream = base.getFile().getInputStream();
+            String originalFilename = base.getFile().getOriginalFilename();
+
+            PutObjectResult putObjectResult = ossClient.putObject(ALIYUN_OSS_BUCKET_NAME, path, inputStream);
+            // 关闭OSSClient。
+            //ossClient.shutdown();
+            return path;
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new IllegalStateException("上传失败");
+        }
+    }
+
+    @Override
+    public String uploadWithUrl(OssRequest base, String urlString){
+        String path = null;
+        InputStream inputStream = null;
+        try {
+            URL url = new URL(urlString);
+            URLConnection con = url.openConnection();
+            //获取上传文件输入流
+            inputStream =con.getInputStream();
+            path = uploadInputStream(inputStream,base.getImageStatus());
+
+            // 关闭OSSClient。
+            //ossClient.shutdown();
+            return path;
+        } catch (Exception e) {
+
+        }finally {
+            try {
+                if (null != inputStream) {
+                    inputStream.close();
+                }
+            }catch (IOException e){
+
+            }
+            return path;
+        }
+    }
+
     @Override
     public String uploadInputStream(InputStream inputStream, Integer imageStatus) throws Exception {
         try {
@@ -278,7 +323,12 @@ public class OssServiceImpl implements OssService {
         try {
             OssRequest ossRequest = new OssRequest();
             ossRequest.setImageStatus(imageStatus);
-            String fileName = generateRandomFilename(ossRequest) + ".jpg";
+            String fileName = null;
+            if(imageStatus<10){
+                fileName = generateRandomFilename(ossRequest) + ".jpg";
+            }else{
+                fileName = generateRandomFilename(ossRequest);
+            }
 
             //调用oss方法实现上传
             //第一个参数  Bucket名称
@@ -337,9 +387,36 @@ public class OssServiceImpl implements OssService {
         }
     }
 
+    @Override
     public InputStream getStreamByObject(String filePath) throws Exception {
-            OSSObject ossObject = ossClient.getObject(ALIYUN_OSS_BUCKET_NAME, filePath);
-            return ossObject.getObjectContent();
+        OSSObject ossObject = ossClient.getObject(ALIYUN_OSS_BUCKET_NAME, filePath);
+        return ossObject.getObjectContent();
+    }
+
+    @Override
+    public void processObject(String targetImage,String sourceImage, String styleType) {
+        try {
+            StringBuilder sbStyle = new StringBuilder();
+            Formatter styleFormatter = new Formatter(sbStyle);
+            styleFormatter.format("%s|sys/saveas,o_%s,b_%s", styleType,
+                    BinaryUtil.toBase64String(targetImage.getBytes()),
+                    BinaryUtil.toBase64String(ALIYUN_OSS_BUCKET_NAME.getBytes()));
+            ProcessObjectRequest request = new ProcessObjectRequest(ALIYUN_OSS_BUCKET_NAME, sourceImage, sbStyle.toString());
+            GenericResult processResult = ossClient.processObject(request);
+            String json = IOUtils.readStreamAsString(processResult.getResponse().getContent(), "UTF-8");
+            processResult.getResponse().getContent().close();
+        } catch (OSSException oe) {
+            System.out.println("Caught an OSSException, which means your request made it to OSS, "
+                    + "but was rejected with an error response for some reason.");
+            System.out.println("Error Message:" + oe.getErrorMessage());
+            System.out.println("Error Code:" + oe.getErrorCode());
+            System.out.println("Request ID:" + oe.getRequestId());
+            System.out.println("Host ID:" + oe.getHostId());
+        }catch (IOException e) {
+
+        } finally {
+
+        }
     }
 
     public void zipFile(List<String> fileList, ZipOutputStream zipOut,String dir) {
@@ -402,7 +479,7 @@ public class OssServiceImpl implements OssService {
     @Override
     public void zipPeopleDownload(ClassPeriodStudentExportVo vo, ZipOutputStream outStream) {
         //学时照片
-        List<String> list = iUserStudyRecordPhotoService.selectGradePhoto(vo.getUserId(),vo.getGradeId());
+        List<String> list = iUserStudyRecordPhotoService.selectGradePhoto(vo.getUserId(),vo.getGradeId(),vo.getOrderGoodsId());
         zipFile(list, outStream,vo.getRealName()+"-"+vo.getIdCard()+"-"+vo.getGradeId()+"/"+"学习照片");  //
         //个人资料
         List<String> listInfo = new ArrayList<>();
@@ -418,6 +495,25 @@ public class OssServiceImpl implements OssService {
         zipFile(listInfo, outStream,vo.getRealName()+"-"+vo.getIdCard()+"-"+vo.getGradeId()+"/"+"资料照片");  //
     }
 
+    @Override
+    public void zipPeopleWeekDownload(ClassPeriodStudentExportVo vo, ZipOutputStream outStream, WeekDataVo weekDataVo) {
+        //学时照片
+        List<String> list = iUserStudyRecordPhotoService.selectGradePhotoWeek(vo.getUserId(),vo.getGradeId(),weekDataVo.getSearchWeekStartTime(),weekDataVo.getSearchWeekEndTime(),vo.getOrderGoodsId());
+        zipFile(list, outStream,weekDataVo.getWeekCxt()+"/"+vo.getRealName()+"-"+vo.getIdCard()+"-"+vo.getGradeId()+"/"+"学习照片");  //
+        //个人资料
+        List<String> listInfo = new ArrayList<>();
+        if(Validator.isNotEmpty(vo.getOneInchPhotosOss())){
+            listInfo.add(vo.getOneInchPhotosOss());
+        }
+        if(Validator.isNotEmpty(vo.getIdCardImg1Oss())){
+            listInfo.add(vo.getIdCardImg1Oss());
+        }
+        if(Validator.isNotEmpty(vo.getIdCardImg2Oss())){
+            listInfo.add(vo.getIdCardImg2Oss());
+        }
+        zipFile(listInfo, outStream,weekDataVo.getWeekCxt()+"/"+vo.getRealName()+"-"+vo.getIdCard()+"-"+vo.getGradeId()+"/"+"资料照片");  //
+    }
+
     @Override
     public void zipCommonDownload(List<String> fileList, ZipOutputStream zipOut,String dir) {
         zipFile(fileList, zipOut,dir);

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/alisms/service/IAliSmsService.java

@@ -3,8 +3,6 @@ package com.zhongzheng.modules.alisms.service;
 
 import com.zhongzheng.modules.alisms.vo.ResultBean;
 
-import javax.servlet.http.HttpServletRequest;
-
 public interface IAliSmsService {
     ResultBean sendSms(String tel,String param);
 
@@ -26,4 +24,6 @@ public interface IAliSmsService {
     Boolean sendSellerForgetSms(String tel);
 
     Boolean sendSellerLoginSms(String tel);
+
+    Boolean sendLiveSms(String tel);
 }

+ 39 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/alisms/service/impl/AliSmsServiceImpl.java

@@ -91,7 +91,14 @@ public class AliSmsServiceImpl implements IAliSmsService {
         //发送带指定短信code带参数发送不同短信内容
         try{
             SendSmsResponse response = SmsUtils.sendSms(tel,SIGNNAME,code,param,ACCESSKEYID,ACCESSKEYSECRET);
+            LOGGER.error("发送短信结果:"+JSON.toJSONString(response));
             if(response.getBody().getMessage().equals("OK")){
+                SmsAddBo smsAddBo = new SmsAddBo();
+                smsAddBo.setCode(param);
+                smsAddBo.setTel(tel);
+                smsAddBo.setType(9L);
+                smsAddBo.setIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
+                iSmsService.insertByAddBo(smsAddBo);
                 return new ResultBean(response);
             }
             return null;
@@ -349,4 +356,36 @@ public class AliSmsServiceImpl implements IAliSmsService {
         }
         return false;
     }
+
+    @Override
+    public Boolean sendLiveSms(String tel) {
+        if(tel==null){
+            throw new CustomException("手机号码不能为空");
+        }
+        User user = iUserService.getUserByTelNotTenant(tel).stream().findFirst().orElse(null);
+        if(Validator.isEmpty(user)){
+            throw new CustomException("该手机号未注册");
+        }
+        ServletUtils.getResponse().setHeader("TenantId",user.getTenantId().toString());
+        String code = ToolsUtils.getSmsCode();
+        String key = Constants.LOGIN_SMS + tel;
+        redisCache.setCacheObjectTenant(key,code,5, TimeUnit.MINUTES);//5分钟
+        try{
+            Map<String,Object> param = new HashMap<>();
+            param.put("code",code);
+            SendSmsResponse response = SmsUtils.sendSms(tel,SIGNNAME,LOGINTEMPLATECODE, JSON.toJSONString(param),ACCESSKEYID,ACCESSKEYSECRET);
+            if(response.getBody().getMessage().equals("OK")){
+                SmsAddBo smsAddBo = new SmsAddBo();
+                smsAddBo.setCode(code);
+                smsAddBo.setTel(tel);
+                smsAddBo.setType(3L);
+                smsAddBo.setIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
+                iSmsService.insertByAddBo(smsAddBo);
+                return true;
+            }
+        }catch (Exception e){
+            throw new CustomException(e.getMessage());
+        }
+        return false;
+    }
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/ExamAddBo.java

@@ -79,4 +79,7 @@ public class ExamAddBo {
     private ExamSimulateConfigBo simulateConfigJson;
     /** 开启模拟考 1启动(考试类型才能启动) 0关闭 */
     private Integer simulateStatus;
+
+    @ApiModelProperty("商品试卷限制终端学习,多个,拼接  1公众号 2小程序")
+    private String examLimitClient;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/ExamEditBo.java

@@ -99,4 +99,7 @@ public class ExamEditBo {
     private ExamSimulateConfigBo simulateConfigJson;
     /** 开启模拟考 1启动(考试类型才能启动) 0关闭 */
     private Integer simulateStatus;
+
+    @ApiModelProperty("商品试卷限制终端学习,多个,拼接  1公众号 2小程序")
+    private String examLimitClient;
 }

+ 6 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionAddBo.java

@@ -73,6 +73,10 @@ public class QuestionAddBo {
     /** 导入顺序 */
     @ApiModelProperty("导入顺序")
     private Long importSort;
-
-
+    /** 山东题库ID */
+    @ApiModelProperty("山东题库ID")
+    private Long sdQid;
+    /** 来源平台 1自有 2山东 */
+    @ApiModelProperty("来源平台 1自有 2山东")
+    private Integer fromPlat;
 }

+ 8 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionBusinessAddBo.java

@@ -33,4 +33,12 @@ public class QuestionBusinessAddBo {
     /** $column.columnComment */
     @ApiModelProperty("业务类型 1为题目业务 2试卷业务 3章业务 4模块业务")
     private Integer type;
+
+    private String educationName;
+
+    private String projectName;
+
+    private String businessName;
+
+    private String subjectName;
 }

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionEditBo.java

@@ -83,4 +83,11 @@ public class QuestionEditBo {
 
     @ApiModelProperty("题目ID")
     private List<Long> questionIds;
+
+    /** 山东题库ID */
+    @ApiModelProperty("山东题库ID")
+    private Long sdQid;
+    /** 来源平台 1自有 2山东 */
+    @ApiModelProperty("来源平台 1自有 2山东")
+    private Integer fromPlat;
 }

+ 46 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionOtherAddBo.java

@@ -0,0 +1,46 @@
+package com.zhongzheng.modules.bank.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import java.util.Date;
+
+
+
+/**
+ * 第三方题库添加对象 question_other
+ *
+ * @author ruoyi
+ * @date 2023-08-03
+ */
+@Data
+@ApiModel("第三方题库添加对象")
+public class QuestionOtherAddBo {
+
+    /** 用户ID */
+    @ApiModelProperty("用户ID")
+    private Long userId;
+    /** 专业 */
+    @ApiModelProperty("专业")
+    private String majorname;
+    /**  状态 1正常 0关闭 */
+    @ApiModelProperty(" 状态 1正常 0关闭")
+    private Integer status;
+    /** 创建时间 */
+    @ApiModelProperty("创建时间")
+    private Long createTime;
+    /** 更新时间 */
+    @ApiModelProperty("更新时间")
+    private Long updateTime;
+    /** $column.columnComment */
+    @ApiModelProperty("$column.columnComment")
+    private String jsonStr;
+    /** 1 山东题库 */
+    @ApiModelProperty("1 山东题库")
+    private Integer fromPlat;
+    /** 试卷ID */
+    @ApiModelProperty("试卷ID")
+    private Long examId;
+    private Long relExamId;
+}

+ 52 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionOtherEditBo.java

@@ -0,0 +1,52 @@
+package com.zhongzheng.modules.bank.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import java.util.Date;
+
+
+/**
+ * 第三方题库编辑对象 question_other
+ *
+ * @author ruoyi
+ * @date 2023-08-03
+ */
+@Data
+@ApiModel("第三方题库编辑对象")
+public class QuestionOtherEditBo {
+
+    /** $column.columnComment */
+    @ApiModelProperty("$column.columnComment")
+    private Long id;
+
+    /** 用户ID */
+    @ApiModelProperty("用户ID")
+    private Long userId;
+
+    /** 专业 */
+    @ApiModelProperty("专业")
+    private String majorname;
+
+    /**  状态 1正常 0关闭 */
+    @ApiModelProperty(" 状态 1正常 0关闭")
+    private Integer status;
+
+    /** 更新时间 */
+    @ApiModelProperty("更新时间")
+    private Long updateTime;
+
+
+    /** $column.columnComment */
+    @ApiModelProperty("$column.columnComment")
+    private String jsonStr;
+
+    /** 1 山东题库 */
+    @ApiModelProperty("1 山东题库")
+    private Integer fromPlat;
+
+    /** 试卷ID */
+    @ApiModelProperty("试卷ID")
+    private Long examId;
+}

+ 49 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionOtherQueryBo.java

@@ -0,0 +1,49 @@
+package com.zhongzheng.modules.bank.bo;
+
+import com.zhongzheng.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 第三方题库分页查询对象 question_other
+ *
+ * @author ruoyi
+ * @date 2023-08-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel("第三方题库分页查询对象")
+public class QuestionOtherQueryBo extends BaseEntity {
+
+	/** 分页大小 */
+	@ApiModelProperty("分页大小")
+	private Integer pageSize;
+	/** 当前页数 */
+	@ApiModelProperty("当前页数")
+	private Integer pageNum;
+	/** 排序列 */
+	@ApiModelProperty("排序列")
+	private String orderByColumn;
+	/** 排序的方向desc或者asc */
+	@ApiModelProperty(value = "排序的方向", example = "asc,desc")
+	private String isAsc;
+
+
+	/** 用户ID */
+	@ApiModelProperty("用户ID")
+	private Long userId;
+	/** 专业 */
+	@ApiModelProperty("专业")
+	private String majorname;
+	/**  状态 1正常 0关闭 */
+	@ApiModelProperty(" 状态 1正常 0关闭")
+	private Integer status;
+	/** $column.columnComment */
+	@ApiModelProperty("$column.columnComment")
+	private String jsonStr;
+	/** 1 山东题库 */
+	@ApiModelProperty("1 山东题库")
+	private Integer fromPlat;
+}

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/domain/Exam.java

@@ -76,4 +76,7 @@ private static final long serialVersionUID=1L;
     private ExamSimulateConfigBo simulateConfig;
     @TableField(exist = false)
     private Long oId;
+    /** 商品试卷限制终端学习,多个,拼接  1公众号 2小程序 */
+    @TableField(updateStrategy=FieldStrategy.IGNORED)
+    private String examLimitClient;
 }

+ 4 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/domain/Question.java

@@ -64,5 +64,8 @@ private static final long serialVersionUID=1L;
     private Long tenantId;
     @TableField(exist = false)
     private Long oId;
-
+    /** 山东题库ID */
+    private Long sdQid;
+    /** 来源平台 1自有 2山东 */
+    private Integer fromPlat;
 }

+ 41 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/domain/QuestionOld.java

@@ -0,0 +1,41 @@
+package com.zhongzheng.modules.bank.domain;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 题库题目对象 question
+ *
+ * @author hjl
+ * @date 2021-10-22
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+public class QuestionOld implements Serializable {
+
+private static final long serialVersionUID=1L;
+
+    private String title;
+
+    private Integer scenetype;
+
+    private Integer quiztype;
+
+    private Long SdQid;
+
+    private String analysis;
+
+    private List<QuestionOldOptions> options;
+
+    private List<QuestionOldChild> childlist;
+
+}

+ 36 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/domain/QuestionOldChild.java

@@ -0,0 +1,36 @@
+package com.zhongzheng.modules.bank.domain;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 题库题目对象 question
+ *
+ * @author hjl
+ * @date 2021-10-22
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+public class QuestionOldChild implements Serializable {
+
+private static final long serialVersionUID=1L;
+
+    private String title;
+
+    private Integer scenetype;
+
+    private Integer quiztype;
+
+    private Long SdQid;
+
+    private String analysis;
+
+    private List<QuestionOldOptions> options;
+
+
+}

+ 28 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/domain/QuestionOldOptions.java

@@ -0,0 +1,28 @@
+package com.zhongzheng.modules.bank.domain;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 题库题目对象 question
+ *
+ * @author hjl
+ * @date 2021-10-22
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+public class QuestionOldOptions implements Serializable {
+
+private static final long serialVersionUID=1L;
+
+    private String serialnum;
+
+    private Boolean isanswer;
+
+    private String optiontitle;
+
+}

+ 48 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/domain/QuestionOther.java

@@ -0,0 +1,48 @@
+package com.zhongzheng.modules.bank.domain;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+import java.io.Serializable;
+import java.util.Date;
+import java.math.BigDecimal;
+import com.zhongzheng.common.annotation.Excel;
+
+/**
+ * 第三方题库对象 question_other
+ *
+ * @author ruoyi
+ * @date 2023-08-03
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("question_other")
+public class QuestionOther implements Serializable {
+
+private static final long serialVersionUID=1L;
+
+    /** $column.columnComment */
+    @TableId(value = "id")
+    private Long id;
+    /** 用户ID */
+    private Long userId;
+    /** 专业 */
+    private String majorname;
+    /**  状态 1正常 0关闭 */
+    private Integer status;
+    /** 创建时间 */
+    @TableField(fill = FieldFill.INSERT)
+    private Long createTime;
+    /** 更新时间 */
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Long updateTime;
+    /** $column.columnComment */
+    private String jsonStr;
+    /** 1 山东题库 */
+    private Integer fromPlat;
+    /** 试卷ID */
+    private Long examId;
+    private Long relExamId;
+}

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionChapterExamMapper.java

@@ -24,4 +24,6 @@ public interface QuestionChapterExamMapper extends BaseMapper<QuestionChapterExa
 
     @InterceptorIgnore(tenantLine = "true")
     void deleteByIdAndTenant(@Param("newChapterExamId") Long newChapterExamId,@Param("newTenantId") Long newTenantId);
+
+    List<ExamVo> getSimpleList(QuestionChapterExamQueryBo bo);
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionMapper.java

@@ -20,6 +20,10 @@ import java.util.List;
  * @date 2021-10-21
  */
 public interface QuestionMapper extends BaseMapper<Question> {
+    List<Long> selectListByBoBackId(QuestionQueryBo bo);
+
+    List<QuestionVo> selectListByBoWithId(QuestionQueryBo bo);
+
     List<QuestionVo> selectListByBo(QuestionQueryBo bo);
 
     List<GoodsUserQuestionVo> listGoodsUserQuestionVo(GoodsQueryBo bo);

+ 14 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionOtherMapper.java

@@ -0,0 +1,14 @@
+package com.zhongzheng.modules.bank.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.bank.domain.QuestionOther;
+
+/**
+ * 第三方题库Mapper接口
+ *
+ * @author ruoyi
+ * @date 2023-08-03
+ */
+public interface QuestionOtherMapper extends BaseMapper<QuestionOther> {
+
+}

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IExamService.java

@@ -59,4 +59,6 @@ public interface IExamService extends IService<Exam> {
     boolean batchDelExam(QuestionBatchDelBo bo);
 
     Exam getExamByTenant(String code, Long newTenantId);
+
+	boolean getShanDongExam(Long userId,String majorname,Long relExamId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionChapterExamService.java

@@ -29,6 +29,8 @@ public interface IQuestionChapterExamService extends IService<QuestionChapterExa
 
 	List<ExamVo> getDoList(QuestionChapterExamQueryBo bo);
 
+	List<ExamVo> getSimpleList(QuestionChapterExamQueryBo bo);
+
 	/**
 	 * 查询列表
 	 */

+ 55 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionOtherService.java

@@ -0,0 +1,55 @@
+package com.zhongzheng.modules.bank.service;
+
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhongzheng.modules.bank.bo.QuestionOtherAddBo;
+import com.zhongzheng.modules.bank.bo.QuestionOtherEditBo;
+import com.zhongzheng.modules.bank.bo.QuestionOtherQueryBo;
+import com.zhongzheng.modules.bank.domain.QuestionOther;
+import com.zhongzheng.modules.bank.vo.QuestionOtherVo;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 第三方题库Service接口
+ *
+ * @author ruoyi
+ * @date 2023-08-03
+ */
+public interface IQuestionOtherService extends IService<QuestionOther> {
+	/**
+	 * 查询单个
+	 * @return
+	 */
+	QuestionOtherVo queryById(Long id);
+
+	Long queryByUserMajor(Long userId,String majorname,Long relExamId);
+
+	/**
+	 * 查询列表
+	 */
+	List<QuestionOtherVo> queryList(QuestionOtherQueryBo bo);
+
+	/**
+	 * 根据新增业务对象插入第三方题库
+	 * @param bo 第三方题库新增业务对象
+	 * @return
+	 */
+	Long insertByAddBo(QuestionOtherAddBo bo);
+
+	/**
+	 * 根据编辑业务对象修改第三方题库
+	 * @param bo 第三方题库编辑业务对象
+	 * @return
+	 */
+	Boolean updateByEditBo(QuestionOtherEditBo bo);
+
+	/**
+	 * 校验并删除数据
+	 * @param ids 主键集合
+	 * @param isValid 是否校验,true-删除前校验,false-不校验
+	 * @return
+	 */
+	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
+}

+ 16 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionService.java

@@ -3,6 +3,7 @@ package com.zhongzheng.modules.bank.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.zhongzheng.common.core.domain.entity.SysUser;
+import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.modules.bank.bo.QuestionAddBo;
 import com.zhongzheng.modules.bank.bo.QuestionBatchDelBo;
 import com.zhongzheng.modules.bank.bo.QuestionEditBo;
@@ -32,7 +33,7 @@ public interface IQuestionService extends IService<Question> {
 	 */
 	QuestionVo queryById(Long questionId);
 
-	List<QuestionVo> selectListByBo(QuestionQueryBo bo);
+	TableDataInfo<QuestionVo> selectListByBo(QuestionQueryBo bo);
 
 
 	List<GoodsUserQuestionVo> listUserFreeGoodsList(GoodsQueryBo bo);
@@ -85,6 +86,10 @@ public interface IQuestionService extends IService<Question> {
 
 	Map<String,Object> importWordQuestionList(MultipartFile file, Long eduId, Long projectId, Long businessId, Long subjectId);
 
+	Map<String,Object> importJJWordQuestionList(MultipartFile file, Long eduId, Long projectId, Long businessId, Long subjectId);
+
+	Map<String,Object> importXueJianWordQuestionList(MultipartFile file, Long eduId, Long projectId, Long businessId, Long subjectId);
+
     boolean batchDelQuestion(QuestionBatchDelBo bo);
 
     List<BankGoodsExamVo> getBankGoodsExamList(Long goodsId);
@@ -99,4 +104,14 @@ public interface IQuestionService extends IService<Question> {
 
 
     Question getQuestionByTenant(String code, Long newTenantId);
+
+	String insertByAddBoImport(QuestionAddBo bo, Integer no);
+
+	Long insertByAddBoImportBackId(QuestionAddBo bo, Integer no);
+
+    void questionImport();
+
+	String getMeasureList();
+
+	String getTopicList(String topParam);
 }

+ 1 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/ExamQuestionServiceImpl.java

@@ -1,7 +1,7 @@
 package com.zhongzheng.modules.bank.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
-import com.baomidou.dynamic.datasource.annotation.DS;
+
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -27,7 +27,6 @@ import java.util.stream.Collectors;
  * @date 2021-10-22
  */
 @Service
-@DS("slave")
 public class ExamQuestionServiceImpl extends ServiceImpl<ExamQuestionMapper, ExamQuestion> implements IExamQuestionService {
 
     @Autowired

+ 71 - 10
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/ExamServiceImpl.java

@@ -4,7 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
-import com.baomidou.dynamic.datasource.annotation.DS;
+
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
@@ -14,20 +15,18 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
 import com.zhongzheng.common.exception.CustomException;
+import com.zhongzheng.common.type.EncryptHandler;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.common.utils.ToolsUtils;
+import com.zhongzheng.common.utils.http.HttpUtils;
 import com.zhongzheng.modules.bank.bo.*;
-import com.zhongzheng.modules.bank.domain.Exam;
-import com.zhongzheng.modules.bank.domain.ExamQuestion;
-import com.zhongzheng.modules.bank.domain.QuestionBusiness;
-import com.zhongzheng.modules.bank.domain.QuestionChapterExam;
+import com.zhongzheng.modules.bank.domain.*;
 import com.zhongzheng.modules.bank.mapper.ExamMapper;
-import com.zhongzheng.modules.bank.service.IExamQuestionService;
-import com.zhongzheng.modules.bank.service.IExamService;
-import com.zhongzheng.modules.bank.service.IQuestionBusinessService;
-import com.zhongzheng.modules.bank.service.IQuestionChapterExamService;
+import com.zhongzheng.modules.bank.service.*;
 import com.zhongzheng.modules.bank.vo.ExamVo;
 import com.zhongzheng.modules.bank.vo.QuestionChapterExamVo;
+import com.zhongzheng.modules.course.domain.CourseBusiness;
 import com.zhongzheng.modules.course.domain.CourseMenuExam;
 import com.zhongzheng.modules.course.service.ICourseMenuExamService;
 import com.zhongzheng.modules.exam.bo.ExamPaperQueryBo;
@@ -36,8 +35,11 @@ import com.zhongzheng.modules.goods.domain.GoodsAttached;
 import com.zhongzheng.modules.goods.service.IGoodsAttachedService;
 import com.zhongzheng.modules.goods.vo.GoodsAttachedVo;
 import com.zhongzheng.modules.user.bo.CheckUserExamRecordBo;
+import com.zhongzheng.modules.user.domain.User;
 import com.zhongzheng.modules.user.service.IUserExamRecordService;
+import com.zhongzheng.modules.user.service.IUserService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -51,7 +53,6 @@ import java.util.stream.Collectors;
  * @date 2021-10-22
  */
 @Service
-@DS("slave")
 public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IExamService {
 
     @Autowired
@@ -73,6 +74,13 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
     private ExamMapper examMapper;
     @Autowired
     private IUserExamRecordService iUserExamRecordService;
+    @Autowired
+    private IQuestionOtherService iQuestionOtherService;
+    @Autowired
+    private IUserService iUserService;
+
+    @Value("${oldSys.host}")
+    private String OLD_SYS_HOST;
 
     @Override
     public ExamVo queryById(Long examId){
@@ -340,4 +348,57 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
     public Exam getExamByTenant(String code, Long newTenantId) {
         return baseMapper.getExamByTenant(code, newTenantId);
     }
+
+    @Override
+    public boolean getShanDongExam(Long userId,String majorname,Long relExamId) {
+        Boolean getNew = true;
+        User user = iUserService.getOne(new LambdaQueryWrapper<User>()
+                .eq(User::getUserId, userId).last("limit 1"));
+        String idnum = user.getIdCard();
+        String username = user.getRealname();
+        Long nowTime = DateUtils.getNowTime();
+        String sign = ToolsUtils.EncoderByMd5WithUtf(idnum+majorname+nowTime.toString() + "pubilc2022");
+        Map<String,String> map = new HashMap<>();
+        map.put("idnum",idnum);//152301198304206010
+        map.put("tenantId","867735392558919680");
+        map.put("username",username);//袁红军
+        map.put("majorname",majorname);//土建质量员
+        map.put("stamp",nowTime.toString());
+        map.put("sign",sign);
+    //    JSONObject param = JSONObject.parseObject(JSONObject.toJSONString(map));
+        String respone = "";
+        if(getNew){
+            String url = OLD_SYS_HOST+"/system/BussinessApi/InitQdyQuiz";
+            try {
+                respone = HttpUtils.postFormBody(url, map);
+                if (!respone.contains("\"msg\":\"获取成功\"")) {
+                    throw new CustomException("同步请求错误" + respone);
+                }
+                System.out.println(respone);
+                QuestionOtherAddBo addBo = new QuestionOtherAddBo();
+                addBo.setJsonStr(respone);
+                addBo.setFromPlat(1);
+                addBo.setUserId(userId);
+                addBo.setMajorname(majorname);
+                addBo.setRelExamId(relExamId);
+                Long id = iQuestionOtherService.insertByAddBo(addBo);
+                iQuestionOtherService.queryById(id);
+            } catch (Exception e) {
+                throw new CustomException("同步请求错误" + e.getMessage());
+            }
+        }else{
+            QuestionOther add = iQuestionOtherService.getOne(new LambdaQueryWrapper<QuestionOther>()
+                    .eq(QuestionOther::getId, 3L).last("limit 1"));
+            if(Validator.isEmpty(add)){
+                throw new CustomException("模拟数据不存在");
+            }
+            add.setUserId(userId);
+            add.setMajorname(majorname);
+            add.setRelExamId(relExamId);
+            add.setId(null);
+            iQuestionOtherService.save(add);
+        }
+
+        return false;
+    }
 }

+ 1 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionBusinessServiceImpl.java

@@ -1,7 +1,7 @@
 package com.zhongzheng.modules.bank.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
-import com.baomidou.dynamic.datasource.annotation.DS;
+
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -27,7 +27,6 @@ import java.util.stream.Collectors;
  * @date 2021-10-25
  */
 @Service
-@DS("slave")
 public class QuestionBusinessServiceImpl extends ServiceImpl<QuestionBusinessMapper, QuestionBusiness> implements IQuestionBusinessService {
 
     @Autowired

+ 6 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionChapterExamServiceImpl.java

@@ -1,7 +1,7 @@
 package com.zhongzheng.modules.bank.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
-import com.baomidou.dynamic.datasource.annotation.DS;
+
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -31,7 +31,6 @@ import java.util.stream.Collectors;
  * @date 2021-10-25
  */
 @Service
-@DS("slave")
 public class QuestionChapterExamServiceImpl extends ServiceImpl<QuestionChapterExamMapper, QuestionChapterExam> implements IQuestionChapterExamService {
 
     @Autowired
@@ -53,6 +52,11 @@ public class QuestionChapterExamServiceImpl extends ServiceImpl<QuestionChapterE
         return questionChapterExamMapper.getDoList(bo);
     }
 
+    @Override
+    public List<ExamVo> getSimpleList(QuestionChapterExamQueryBo bo) {
+        return this.baseMapper.getSimpleList(bo);
+    }
+
     @Override
     public List<QuestionChapterExamVo> queryList(QuestionChapterExamQueryBo bo) {
         LambdaQueryWrapper<QuestionChapterExam> lqw = Wrappers.lambdaQuery();

+ 1 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionChapterServiceImpl.java

@@ -2,7 +2,7 @@ package com.zhongzheng.modules.bank.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
-import com.baomidou.dynamic.datasource.annotation.DS;
+
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
@@ -44,7 +44,6 @@ import java.util.stream.Collectors;
  * @date 2021-10-25
  */
 @Service
-@DS("slave")
 public class QuestionChapterServiceImpl extends ServiceImpl<QuestionChapterMapper, QuestionChapter> implements IQuestionChapterService {
 
     @Autowired

+ 1 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionModuleChapterServiceImpl.java

@@ -1,7 +1,7 @@
 package com.zhongzheng.modules.bank.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
-import com.baomidou.dynamic.datasource.annotation.DS;
+
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -28,7 +28,6 @@ import java.util.stream.Collectors;
  * @date 2021-10-26
  */
 @Service
-@DS("slave")
 public class QuestionModuleChapterServiceImpl extends ServiceImpl<QuestionModuleChapterMapper, QuestionModuleChapter> implements IQuestionModuleChapterService {
 
     @Autowired

+ 1 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionModuleServiceImpl.java

@@ -2,7 +2,7 @@ package com.zhongzheng.modules.bank.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
-import com.baomidou.dynamic.datasource.annotation.DS;
+
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
@@ -41,7 +41,6 @@ import java.util.stream.Collectors;
  * @date 2021-10-25
  */
 @Service
-@DS("slave")
 public class QuestionModuleServiceImpl extends ServiceImpl<QuestionModuleMapper, QuestionModule> implements IQuestionModuleService {
 
     @Autowired

+ 305 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionOtherServiceImpl.java

@@ -0,0 +1,305 @@
+package com.zhongzheng.modules.bank.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.lang.Validator;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.zhongzheng.common.exception.CustomException;
+import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.modules.bank.bo.*;
+import com.zhongzheng.modules.bank.domain.QuestionOld;
+import com.zhongzheng.modules.bank.domain.QuestionOldChild;
+import com.zhongzheng.modules.bank.domain.QuestionOldOptions;
+import com.zhongzheng.modules.bank.domain.QuestionOther;
+import com.zhongzheng.modules.bank.mapper.QuestionOtherMapper;
+import com.zhongzheng.modules.bank.service.IExamService;
+import com.zhongzheng.modules.bank.service.IQuestionOtherService;
+import com.zhongzheng.modules.bank.service.IQuestionService;
+import com.zhongzheng.modules.bank.vo.ExamVo;
+import com.zhongzheng.modules.bank.vo.QuestionOtherVo;
+import com.zhongzheng.modules.course.service.ICourseMenuExamService;
+import com.zhongzheng.modules.order.domain.OrderGoods;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.github.pagehelper.Page;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 第三方题库Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2023-08-03
+ */
+@Service
+public class QuestionOtherServiceImpl extends ServiceImpl<QuestionOtherMapper, QuestionOther> implements IQuestionOtherService {
+
+    @Autowired
+    private IQuestionService iQuestionService;
+
+    @Autowired
+    private IExamService iExamService;
+
+    @Override
+    public QuestionOtherVo queryById(Long id){
+        QuestionOther db = this.baseMapper.selectById(id);
+        JSONObject jsonObject = (JSONObject) JSONObject.parse(db.getJsonStr());
+        List<QuestionOld> qList = JSONArray.parseArray(String.valueOf(jsonObject.get("data")),QuestionOld.class);
+        if (!db.getJsonStr().contains("\"msg\":\"获取成功\"")) {
+            throw new CustomException("同步请求错误");
+        }
+        int i = 1;
+        List<ExamQuestionAddBo> qIdList = new ArrayList<>();
+        for(QuestionOld old : qList){
+            QuestionAddBo childAddBo = new QuestionAddBo();
+            String importNo = ServletUtils.getEncoded("IMPORT");
+            childAddBo.setStatus(1);
+            childAddBo.setContent(old.getTitle());
+            childAddBo.setSdQid(old.getSdQid());
+            childAddBo.setImportNo(importNo);
+            childAddBo.setCreateTime(DateUtils.getNowTime());
+            childAddBo.setCreateBy("admin");
+            childAddBo.setPublishStatus(1);
+            if(old.getQuiztype()==1){
+                childAddBo.setType(1);
+            }
+            else if(old.getQuiztype()==2){
+                childAddBo.setType(2);
+            }
+            else if(old.getQuiztype()==4){
+                childAddBo.setType(3);
+            }
+            else if(old.getQuiztype()==5){
+                childAddBo.setType(4);
+            }
+
+            if(old.getQuiztype()<3){
+                childAddBo.setAnalysisContent(old.getAnalysis());
+                String answerQuestion="";
+                List<QuestionChildAddBo> optionsList = new ArrayList<>();
+                for(QuestionOldOptions options : old.getOptions()){
+                    QuestionChildAddBo addBo = new QuestionChildAddBo();
+                    addBo.setContent(options.getOptiontitle());
+                    addBo.setOptionsId(dealOptions(options.getSerialnum()));
+                    if(options.getIsanswer()){
+                        answerQuestion+=options.getSerialnum();
+                    }
+                    optionsList.add(addBo);
+                }
+                childAddBo.setOptionsList(optionsList);
+                childAddBo.setAnswerQuestion(dealImportAnswer(answerQuestion));
+            }
+            else if(old.getQuiztype()==4){
+                childAddBo.setAnalysisContent(old.getAnalysis());
+                String answerQuestion="";
+                for(QuestionOldOptions options : old.getOptions()){
+                    if(options.getIsanswer()){
+                        if(options.getSerialnum().equals("A")){
+                            answerQuestion = "1";
+                        }else{
+                            answerQuestion = "0";
+                        }
+                    }
+                }
+                childAddBo.setAnswerQuestion(answerQuestion);
+            }
+            else if(old.getQuiztype()==5){
+                List<QuestionChildAddBo> optionsList = new ArrayList<>();
+                for(QuestionOldChild oldChild :old.getChildlist()){
+                    QuestionChildAddBo addBo = new QuestionChildAddBo();
+                    addBo.setContent(oldChild.getTitle());
+                    if(oldChild.getQuiztype()==1){
+                        addBo.setType(1);
+                    }
+                    else if(oldChild.getQuiztype()==2){
+                        addBo.setType(2);
+                    }
+                    else if(oldChild.getQuiztype()==4){
+                        addBo.setType(3);
+                    }
+                    addBo.setAnalysisContent(oldChild.getAnalysis());
+                    if(oldChild.getQuiztype()<3){
+                        String answerQuestion="";
+                        List<QuestionOptionsAddBo> optionsItemList = new ArrayList<>();
+                        for(QuestionOldOptions options : oldChild.getOptions()){
+                            QuestionOptionsAddBo addChildBo = new QuestionOptionsAddBo();
+                            addChildBo.setContent(options.getOptiontitle());
+                            addChildBo.setOptionsId(dealOptions(options.getSerialnum()));
+                            if(options.getIsanswer()){
+                                answerQuestion+=options.getSerialnum();
+                            }
+                            optionsItemList.add(addChildBo);
+                        }
+                        addBo.setOptionsList(optionsItemList);
+                        addBo.setAnswerQuestion(dealImportAnswer(answerQuestion));
+                    }
+                    else if(oldChild.getQuiztype()==4){
+                        String answerQuestion="";
+                        for(QuestionOldOptions options : oldChild.getOptions()){
+                            if(options.getIsanswer()){
+                                if(options.getSerialnum().equals("A")){
+                                    answerQuestion = "1";
+                                }else{
+                                    answerQuestion = "0";
+                                }
+                            }
+                        }
+                        addBo.setAnswerQuestion(answerQuestion);
+                    }
+                    optionsList.add(addBo);
+                }
+                childAddBo.setOptionsList(optionsList);
+            }
+            childAddBo.setFromPlat(2);
+            Long qId = iQuestionService.insertByAddBoImportBackId(childAddBo,i);
+            ExamQuestionAddBo questionAddBo = new ExamQuestionAddBo();
+            questionAddBo.setQuestionId(qId);
+            questionAddBo.setSort(i);
+            qIdList.add(questionAddBo);
+            i++;
+        }
+        ExamAddBo examAddBo = new ExamAddBo();
+        examAddBo.setExamName("七大员新考试卷");
+        examAddBo.setDoType(1);
+        examAddBo.setStatus(1);
+        examAddBo.setPublishStatus(1L);
+        examAddBo.setQuestionList(qIdList);
+        ExamVo examVo = iExamService.insertByAddBo(examAddBo);
+        QuestionOtherEditBo editBo = new QuestionOtherEditBo();
+        editBo.setId(id);
+        editBo.setExamId(examVo.getExamId());
+        updateByEditBo(editBo);
+        return BeanUtil.toBean(db, QuestionOtherVo.class);
+    }
+
+    @Override
+    public Long queryByUserMajor(Long userId, String majorname,Long relExamId) {
+        QuestionOther questionOther = getOne(new LambdaQueryWrapper<QuestionOther>()
+                .eq(QuestionOther::getUserId, userId).eq(QuestionOther::getMajorname, majorname).eq(QuestionOther::getRelExamId, relExamId)
+                .eq(QuestionOther::getStatus, 1));
+        if(Validator.isNotEmpty(questionOther)){
+            return questionOther.getExamId();
+        }
+        iExamService.getShanDongExam(userId,majorname, relExamId);
+        questionOther = getOne(new LambdaQueryWrapper<QuestionOther>()
+                .eq(QuestionOther::getUserId, userId).eq(QuestionOther::getMajorname, majorname).eq(QuestionOther::getRelExamId, relExamId)
+                .eq(QuestionOther::getStatus, 1));
+        if(Validator.isNotEmpty(questionOther)){
+            return questionOther.getExamId();
+        }
+        return null;
+    }
+
+    private Long dealOptions(String v) {
+        if ("A".equals(v)) {
+           return 1L;
+        } else if ("B".equals(v)) {
+            return 2L;
+        } else if ("C".equals(v)) {
+            return 3L;
+        } else if ("D".equals(v)) {
+            return 4L;
+        } else if ("E".equals(v)) {
+            return 5L;
+        } else if ("F".equals(v)) {
+            return 6L;
+        }
+        return 99L;
+    }
+
+    private String dealImportAnswer(String Answer) {
+        String[] itemArray = Answer.split("");
+        List<String> list = new ArrayList<>();
+        for (String v : itemArray) {
+            if ("A".equals(v)) {
+                list.add("1");
+            } else if ("B".equals(v)) {
+                list.add("2");
+            } else if ("C".equals(v)) {
+                list.add("3");
+            } else if ("D".equals(v)) {
+                list.add("4");
+            } else if ("E".equals(v)) {
+                list.add("5");
+            } else if ("F".equals(v)) {
+                list.add("6");
+            }
+        }
+        return String.join(",", list);
+    }
+
+    @Override
+    public List<QuestionOtherVo> queryList(QuestionOtherQueryBo bo) {
+        LambdaQueryWrapper<QuestionOther> lqw = Wrappers.lambdaQuery();
+        lqw.eq(bo.getUserId() != null, QuestionOther::getUserId, bo.getUserId());
+        lqw.like(StrUtil.isNotBlank(bo.getMajorname()), QuestionOther::getMajorname, bo.getMajorname());
+        lqw.eq(bo.getStatus() != null, QuestionOther::getStatus, bo.getStatus());
+        lqw.eq(StrUtil.isNotBlank(bo.getJsonStr()), QuestionOther::getJsonStr, bo.getJsonStr());
+        lqw.eq(bo.getFromPlat() != null, QuestionOther::getFromPlat, bo.getFromPlat());
+        return entity2Vo(this.list(lqw));
+    }
+
+    /**
+    * 实体类转化成视图对象
+    *
+    * @param collection 实体类集合
+    * @return
+    */
+    private List<QuestionOtherVo> entity2Vo(Collection<QuestionOther> collection) {
+        List<QuestionOtherVo> voList = collection.stream()
+                .map(any -> BeanUtil.toBean(any, QuestionOtherVo.class))
+                .collect(Collectors.toList());
+        if (collection instanceof Page) {
+            Page<QuestionOther> page = (Page<QuestionOther>)collection;
+            Page<QuestionOtherVo> pageVo = new Page<>();
+            BeanUtil.copyProperties(page,pageVo);
+            pageVo.addAll(voList);
+            voList = pageVo;
+        }
+        return voList;
+    }
+
+    @Override
+    public Long insertByAddBo(QuestionOtherAddBo bo) {
+        QuestionOther add = BeanUtil.toBean(bo, QuestionOther.class);
+        validEntityBeforeSave(add);
+        add.setCreateTime(DateUtils.getNowTime());
+        add.setUpdateTime(DateUtils.getNowTime());
+        this.save(add);
+        return add.getId();
+    }
+
+    @Override
+    public Boolean updateByEditBo(QuestionOtherEditBo bo) {
+        QuestionOther update = BeanUtil.toBean(bo, QuestionOther.class);
+        validEntityBeforeSave(update);
+        update.setUpdateTime(DateUtils.getNowTime());
+        return this.updateById(update);
+    }
+
+    /**
+     * 保存前的数据校验
+     *
+     * @param entity 实体类数据
+     */
+    private void validEntityBeforeSave(QuestionOther entity){
+        //TODO 做一些数据校验,如唯一约束
+    }
+
+    @Override
+    public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
+        if(isValid){
+            //TODO 做一些业务上的校验,判断是否需要校验
+        }
+        return this.removeByIds(ids);
+    }
+}

Plik diff jest za duży
+ 1067 - 144
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java


+ 7 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/vo/ExamVo.java

@@ -3,6 +3,7 @@ package com.zhongzheng.modules.bank.vo;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.zhongzheng.common.annotation.Excel;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.zhongzheng.modules.bank.bo.QuestionBusinessAddBo;
 import com.zhongzheng.modules.course.vo.CourseGoodsVo;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
 import io.swagger.annotations.ApiModel;
@@ -154,5 +155,10 @@ public class ExamVo {
 	@Excel(name = "开启模拟考 1启动(考试类型才能启动) 0关闭")
 	@ApiModelProperty("开启模拟考 1启动(考试类型才能启动) 0关闭")
 	private Integer simulateStatus;
-
+	/** 商品试卷限制终端学习,多个,拼接  1公众号 2小程序 */
+	@Excel(name = "商品试卷限制终端学习,多个,拼接  1公众号 2小程序")
+	@ApiModelProperty("商品试卷限制终端学习,多个,拼接  1公众号 2小程序")
+	private String examLimitClient;
+	@ApiModelProperty("业务层级列表")
+	private List<QuestionBusinessAddBo> businessList;
 }

+ 27 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/vo/ExternalQuestionChildTopicVo.java

@@ -0,0 +1,27 @@
+package com.zhongzheng.modules.bank.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author yangdamao
+ * @date 2023年12月06日 16:28
+ */
+@Data
+public class ExternalQuestionChildTopicVo implements Serializable {
+
+    private Long measureId;
+
+    private String title;
+
+    private Integer topicType;
+
+    private String description;
+
+    private Integer sortNumber;
+
+    private List<ExternalQuestionChildVo> childList;
+
+}

+ 20 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/vo/ExternalQuestionChildVo.java

@@ -0,0 +1,20 @@
+package com.zhongzheng.modules.bank.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author yangdamao
+ * @date 2023年12月06日 16:28
+ */
+@Data
+public class ExternalQuestionChildVo implements Serializable {
+
+    private Long topicOptionId;
+
+    private String optionTitle;
+
+    private Boolean isAnswer;
+
+}

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików