yangdamao 2 år sedan
förälder
incheckning
2b25a9de96
100 ändrade filer med 5129 tillägg och 662 borttagningar
  1. 67 5
      zhongzheng-admin-data/src/main/resources/application-dev.yml
  2. 88 27
      zhongzheng-admin-data/src/main/resources/application-prod.yml
  3. 67 4
      zhongzheng-admin/src/main/resources/application-dev.yml
  4. 62 0
      zhongzheng-admin/src/main/resources/application-prod.yml
  5. 16 6
      zhongzheng-common/pom.xml
  6. 1 1
      zhongzheng-common/src/main/java/com/zhongzheng/common/core/domain/entity/SysDictData.java
  7. 2 2
      zhongzheng-common/src/main/java/com/zhongzheng/common/core/domain/entity/TopSysUser.java
  8. 301 53
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/DateUtils.java
  9. 3 2
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/ServletUtils.java
  10. 54 0
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/TelPhoneUtils.java
  11. 233 4
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/ToolsUtils.java
  12. 271 6
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/file/FileUtils.java
  13. 20 0
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/file/ImageUtils.java
  14. 107 31
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/http/HttpUtils.java
  15. 319 1
      zhongzheng-common/src/main/java/com/zhongzheng/common/utils/poi/ExcelUtil.java
  16. BIN
      zhongzheng-common/src/main/resources/static/002.jpg
  17. BIN
      zhongzheng-common/src/main/resources/static/003.jpg
  18. 8 2
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/aspectj/LogAspect.java
  19. 1 0
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/config/MybatisPlusConfig.java
  20. 18 5
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/config/SecurityConfig.java
  21. 4 4
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/mybatisplus/CreateAndUpdateMetaObjectHandler.java
  22. 2 2
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/mybatisplus/CustomTenantLineHandler.java
  23. 11 4
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/security/filter/JwtAuthenticationTokenFilter.java
  24. 2 3
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/DistributionSellerServiceImpl.java
  25. 1 1
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/SysLoginService.java
  26. 116 8
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/SysTenantServiceImpl.java
  27. 2 2
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/TokenService.java
  28. 651 15
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java
  29. 146 1
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/WxLoginService.java
  30. 23 14
      zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/WxTokenService.java
  31. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/bo/ActivityRecommendQueryBo.java
  32. 2 3
      zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/service/impl/ActivityGoodsPriceServiceImpl.java
  33. 12 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/service/impl/ActivityRecommendServiceImpl.java
  34. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/activity/vo/ActivityRecommendVo.java
  35. 4 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/bo/OssRequest.java
  36. 12 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/OssService.java
  37. 114 18
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alioss/service/impl/OssServiceImpl.java
  38. 2 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alisms/service/IAliSmsService.java
  39. 39 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/alisms/service/impl/AliSmsServiceImpl.java
  40. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/ExamAddBo.java
  41. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/ExamEditBo.java
  42. 6 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionAddBo.java
  43. 8 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionBusinessAddBo.java
  44. 7 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionEditBo.java
  45. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/domain/Exam.java
  46. 4 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/domain/Question.java
  47. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionChapterExamMapper.java
  48. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/mapper/QuestionMapper.java
  49. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IExamService.java
  50. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionChapterExamService.java
  51. 16 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/IQuestionService.java
  52. 1 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/ExamQuestionServiceImpl.java
  53. 71 10
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/ExamServiceImpl.java
  54. 1 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionBusinessServiceImpl.java
  55. 6 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionChapterExamServiceImpl.java
  56. 1 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionChapterServiceImpl.java
  57. 1 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionModuleChapterServiceImpl.java
  58. 1 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionModuleServiceImpl.java
  59. 1067 144
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java
  60. 7 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/vo/ExamVo.java
  61. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/vo/QuestionVo.java
  62. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/bo/ShoppingCartAddBo.java
  63. 7 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/bo/ShoppingCartEditBo.java
  64. 9 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/bo/UserProfileQueryBo.java
  65. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/domain/ShoppingCart.java
  66. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/mapper/UserProfileMapper.java
  67. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/ICertificateTpService.java
  68. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/IProfileTpService.java
  69. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/IShoppingCartService.java
  70. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/IUserProfileService.java
  71. 13 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/ActivityAdvertisingServiceImpl.java
  72. 1 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/CertificateCommonServiceImpl.java
  73. 1 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/CertificateServiceImpl.java
  74. 789 243
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/CertificateTpServiceImpl.java
  75. 1 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/ProfileFieldServiceImpl.java
  76. 1 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/ProfileTpBusinessServiceImpl.java
  77. 53 2
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/ProfileTpServiceImpl.java
  78. 26 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/ShoppingCartServiceImpl.java
  79. 73 8
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/UserProfileServiceImpl.java
  80. 6 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/vo/CertificatePhotoVo.java
  81. 8 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/vo/ShoppingCartVo.java
  82. 6 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/vo/UserProfileVo.java
  83. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/collect/mapper/CollectQuestionMapper.java
  84. 7 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/collect/service/impl/CollectQuestionServiceImpl.java
  85. 6 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CheckSectionWatchVo.java
  86. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseAddBo.java
  87. 1 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseBusinessQueryBo.java
  88. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseChapterAddBo.java
  89. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseChapterEditBo.java
  90. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseEditBo.java
  91. 1 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseHandoutsEditBo.java
  92. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseMenuAddBo.java
  93. 4 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseMenuEditBo.java
  94. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseMenuQueryBo.java
  95. 14 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseModuleAddBo.java
  96. 16 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseModuleEditBo.java
  97. 1 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CoursePhotoLogAddBo.java
  98. 1 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CoursePhotoLogQueryBo.java
  99. 33 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseQueryBo.java
  100. 3 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/course/domain/Course.java

+ 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

+ 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

+ 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=否")

+ 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)

+ 301 - 53
zhongzheng-common/src/main/java/com/zhongzheng/common/utils/DateUtils.java

@@ -7,10 +7,7 @@ import org.apache.commons.lang3.time.DateFormatUtils;
 import java.lang.management.ManagementFactory;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.time.DayOfWeek;
-import java.time.Instant;
-import java.time.LocalDateTime;
-import java.time.ZoneOffset;
+import java.time.*;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 
@@ -27,6 +24,8 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
 
     public static String YYYY_MM_DD = "yyyy-MM-dd";
 
+    public static String YYYYMMDD = "yyyyMMdd";
+
     public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
 
     public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
@@ -121,6 +120,32 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return DateFormatUtils.format(date, "yyyy/MM/dd");
     }
 
+    public static Date timeToDate(Long times){
+        long t = times.longValue();
+        t = t * 1000;
+        return new Date(t);
+    }
+
+    public static String timestampToDateFormatMonth(Long times){
+        if(Validator.isEmpty(times)){
+            return "";
+        }
+        long t = times.longValue();
+        t = t * 1000;
+        Date date = new Date(t);
+        return DateFormatUtils.format(date, "MM月dd号");
+    }
+
+    public static String timestampToDateFormatMonthTwo(Long times){
+        if(Validator.isEmpty(times)){
+            return "";
+        }
+        long t = times.longValue();
+        t = t * 1000;
+        Date date = new Date(t);
+        return DateFormatUtils.format(date, "MM.dd");
+    }
+
     public static String timestampToDateFormat(Long times,String patternStr){
         if(Validator.isEmpty(times)){
             return "";
@@ -131,6 +156,32 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return DateFormatUtils.format(date, patternStr);
     }
 
+
+    /**
+     * 将秒转为时分秒格式【01:01:01】
+     * @param second 需要转化的秒数
+     * @return
+     */
+    public static String secondConvertHourMinSecond(Long second) {
+        String str = "";
+        if (second == null || second < 0) {
+            return str;
+        }
+
+        // 得到小时
+        long h = second / 3600;
+        str = h > 0 ? ((h < 10 ? ("0" + h) : h) + "时") : "";
+
+        // 得到分钟
+        long m = (second % 3600) / 60;
+        str += m > 0? (m < 10 ? ("0" + m) : m) + "分":"";
+
+        //得到剩余秒
+        long s = second % 60;
+        str += s > 0?(s < 10 ? ("0" + s) : s)+"秒":"";
+        return str;
+    }
+
     public static String timestampToDate(Long times){
         if(Validator.isEmpty(times)){
             return "";
@@ -224,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);
@@ -253,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;
+    }
+
     /**
      * 根据当前日期获得所在周的日期区间(周一和周日日期)
      */
@@ -329,6 +415,21 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return "P"+getDateOrderSn();
     }
 
+    public static String getInvoiceOrderSn()
+    {
+        DateTimeFormatter ofPattern = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
+        String localDate = (LocalDateTime.now().format(ofPattern)).substring(2);
+        //随机数
+        String randomNumeric = RandomStringUtils.randomNumeric(4);
+        return "IN"+localDate+randomNumeric;
+
+    }
+
+    public static String getTagOrderSn(String tag)
+    {
+        return tag+getDateOrderSn();
+    }
+
     public static String secToTime(int time) {
         String timeStr = null;
         int hour = 0;
@@ -343,8 +444,9 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
                 timeStr = "00:"+unitFormat(minute) + ":" + unitFormat(second);
             } else {
                 hour = minute / 60;
-                if (hour > 99)
+                if (hour > 99){
                     return "99:59:59";
+                }
                 minute = minute % 60;
                 second = time - hour * 3600 - minute * 60;
                 timeStr = unitFormat(hour) + ":" + unitFormat(minute) + ":" + unitFormat(second);
@@ -371,6 +473,132 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return hh*60*60+mi*60+ss;
     }
 
+    public static Integer dayBetween(Long s1,Long s2) {
+        String date1str = timestampToDateFormat(s1);
+        String date2str = timestampToDateFormat(s2);
+        int count = 0;
+        if("".equals(date1str) || date1str == null || "".equals(date2str) || date2str == null) {
+            return count;
+        }
+        SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd");
+       try {
+           Date date1 = format.parse(date1str);
+           Date date2 = format.parse(date2str);
+           count = ((int) ((date1.getTime() - date2.getTime()) / (1000*3600*24)));
+           return count;
+        }catch (Exception e){
+           return null;
+       }
+    }
+
+    public static  Integer getTodayWeek(){
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        int weekIdx = calendar.get(Calendar.DAY_OF_WEEK) - 1;
+        switch (weekIdx) {
+            case 1:
+                return 1;
+            case 2:
+                return 2;
+            case 3:
+                return 3;
+            case 4:
+                return 4;
+            case 5:
+                return 5;
+            case 6:
+                return 6;
+            default:
+                return 7;
+        }
+    }
+
+
+    public static LocalDate[] getDateArray() {
+        // 创建一个长度为30的数组
+        LocalDate[] dates = new LocalDate[30];
+        // 获取今天的日期
+        LocalDate today = LocalDate.now();
+        // 用循环给数组赋值
+        for (int i = 0; i < dates.length; i++) {
+            // 用today.plusDays(i)得到第i天的日期
+            dates[i] = today.plusDays(i);
+        }
+        // 返回数组
+        return dates;
+    }
+
+    static List<String> holiday =new ArrayList<>();
+    static List<String> extraWorkDay =new ArrayList<>();
+    public static Boolean isWorkingDay(long time) {
+        LocalDateTime dateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneOffset.of("+8"));
+        String formatTime = dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+        initHoliday();
+        initExtraWorkDay();
+        //是否加班日
+        if(extraWorkDay.contains(formatTime)){
+            return true;
+        }
+        //是否节假日
+        if(holiday.contains(formatTime)){
+            return false;
+        }
+        //如果是1-5表示周一到周五  是工作日
+        DayOfWeek week = dateTime.getDayOfWeek();
+        if(week==DayOfWeek.SATURDAY||week==DayOfWeek.SUNDAY){
+            return false;
+        }
+        return true;
+
+    }
+
+    /**
+     *  初始化节假日
+     */
+    public static void initHoliday(){
+        holiday.add("2023-06-22");
+        holiday.add("2023-06-23");
+        holiday.add("2023-09-29");
+        holiday.add("2023-09-30");
+        holiday.add("2023-10-01");
+        holiday.add("2023-10-02");
+        holiday.add("2023-10-03");
+        holiday.add("2023-10-04");
+        holiday.add("2023-10-05");
+        holiday.add("2023-10-06");
+    }
+    /**
+     *  初始化额外加班日
+     */
+    public static void initExtraWorkDay(){
+        extraWorkDay.add("2023-06-25");
+        extraWorkDay.add("2023-10-07");
+        extraWorkDay.add("2023-10-08");
+    }
+
+
+    public static Long getAppointTime(Long millisecond, Integer day) {
+        for (Integer i = 0; i < day; i++) {
+            Long dayAfter = getDayBefore(millisecond, 1);
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(timeToDate(dayAfter));
+            int index = calendar.get(Calendar.DAY_OF_WEEK) - 1;
+            String[] weeks = new String[]{"星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
+
+            if (weeks[index].equals("星期六") || weeks[index].equals("星期天")) {
+                day += 1;
+
+            }
+            //判断当前是否为工作日
+            if (!isWorkingDay(dayAfter)) {
+                day += 1;
+            }
+            millisecond = dayAfter;
+        }
+
+        return millisecond;
+    }
+
     /**
      * 指定时间往前或往后推n天
      *
@@ -405,58 +633,78 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return c.getTime().getTime()/1000;
     }
 
-    public static Date timeToDate(Long times){
-        long t = times.longValue();
-        t = t * 1000;
-        return new Date(t);
-    }
 
-    static List<String> holiday =new ArrayList<>();
-    static List<String> extraWorkDay =new ArrayList<>();
-
-    /**
-     *  初始化节假日
-     */
-    public static void initHoliday(){
-        holiday.add("2023-06-22");
-        holiday.add("2023-06-23");
-        holiday.add("2023-09-29");
-        holiday.add("2023-09-30");
-        holiday.add("2023-10-01");
-        holiday.add("2023-10-02");
-        holiday.add("2023-10-03");
-        holiday.add("2023-10-04");
-        holiday.add("2023-10-05");
-        holiday.add("2023-10-06");
-    }
-    /**
-     *  初始化额外加班日
-     */
-    public static void initExtraWorkDay(){
-        extraWorkDay.add("2023-06-25");
-        extraWorkDay.add("2023-10-07");
-        extraWorkDay.add("2023-10-08");
+    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 Boolean isWorkingDay(long time) {
-        LocalDateTime dateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneOffset.of("+8"));
-        String formatTime = dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
-        initHoliday();
-        initExtraWorkDay();
-        //是否加班日
-        if(extraWorkDay.contains(formatTime)){
-            return true;
-        }
-        //是否节假日
-        if(holiday.contains(formatTime)){
-            return false;
+
+    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));
         }
-        //如果是1-5表示周一到周五  是工作日
-        DayOfWeek week = dateTime.getDayOfWeek();
-        if(week==DayOfWeek.SATURDAY||week==DayOfWeek.SUNDAY){
-            return false;
+        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 true;
-
+        return map;
     }
+
 }

+ 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
@@ -296,6 +316,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))){
@@ -307,13 +338,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();
@@ -337,6 +400,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;
@@ -350,14 +423,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")){
@@ -421,4 +494,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;
+    }
+
 }

+ 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/002.jpg


BIN
zhongzheng-common/src/main/resources/static/003.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;

+ 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;
     }
 

+ 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;
 }

+ 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;
 }

+ 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);

+ 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);
+
 	/**
 	 * 查询列表
 	 */

+ 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

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 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;
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/vo/QuestionVo.java

@@ -130,4 +130,9 @@ public class QuestionVo {
 	@Excel(name = "多选 每项部分分,默认0分则不开启")
 	@ApiModelProperty("多选 每项部分分,默认0分则不开启")
 	private BigDecimal partScore;
+	private Long sdQid;
+	/** 来源平台 1自有 2山东 */
+	@Excel(name = "来源平台 1自有 2山东")
+	@ApiModelProperty("来源平台 1自有 2山东")
+	private Integer fromPlat;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/bo/ShoppingCartAddBo.java

@@ -37,4 +37,6 @@ public class ShoppingCartAddBo {
     private Integer status;
     @ApiModelProperty("分销码")
     private String distributionCode;
+    @ApiModelProperty("勾选状态 0无 1已勾选")
+    private Integer choiceStatus;
 }

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/bo/ShoppingCartEditBo.java

@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import java.util.Date;
+import java.util.List;
 
 
 /**
@@ -37,4 +38,10 @@ public class ShoppingCartEditBo {
     @ApiModelProperty("1 启用 0未启用 -1删除")
     private Integer status;
 
+    @ApiModelProperty("勾选状态 0无 1已勾选")
+    private Integer choiceStatus;
+
+    private List<Long> ids;
+
+
 }

+ 9 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/bo/UserProfileQueryBo.java

@@ -118,4 +118,13 @@ public class UserProfileQueryBo extends BaseEntity implements Serializable {
 	/** 订单商品ID */
 	@ApiModelProperty("订单商品ID")
 	private Long orderGoodsId;
+
+	@ApiModelProperty("报名开始时间")
+	private Long applyStartTime;
+
+	@ApiModelProperty("报名结束时间")
+	private Long applyEndTime;
+
+	@ApiModelProperty("公司名称")
+	private String companyName;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/domain/ShoppingCart.java

@@ -4,6 +4,7 @@ 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 io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
@@ -41,4 +42,6 @@ private static final long serialVersionUID=1L;
     private Integer status;
     /** 分销码*/
     private String distributionCode;
+
+    private Integer choiceStatus;
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/mapper/UserProfileMapper.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.base.mapper;
 
+import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import com.zhongzheng.common.annotation.DataScope;
 import com.zhongzheng.modules.base.bo.ConsoleQueryBo;
 import com.zhongzheng.modules.base.bo.UserProfileQueryBo;
@@ -29,4 +30,7 @@ public interface UserProfileMapper extends BaseMapper<UserProfile> {
     Long selectGrade(@Param("userId") Long userId,@Param("goodsId") Long goodsId);
 
     Integer getProfileStatusNum(ConsoleQueryBo bo);
+
+    @InterceptorIgnore(tenantLine = "true")
+    UserProfile getByOrderGoodsIdNoTenant(Long orderGoodsId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/ICertificateTpService.java

@@ -45,6 +45,8 @@ public interface ICertificateTpService extends IService<CertificateTp> {
 
 	String makeCertificatePhoto(ClassGradeUserQueryBo bo);
 
+	String makeBatchCertificatePhoto(ClassGradeUserQueryBo bo);
+
 	List<CertificateTpVo> selectListByBo(CertificateTpQueryBo bo);
 
 	/**

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/IProfileTpService.java

@@ -6,6 +6,8 @@ import com.zhongzheng.modules.base.bo.ProfileTpEditBo;
 import com.zhongzheng.modules.base.bo.ProfileTpQueryBo;
 import com.zhongzheng.modules.base.domain.ProfileTp;
 import com.zhongzheng.modules.base.vo.ProfileTpVo;
+import com.zhongzheng.modules.user.bo.CommitmentSealBo;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.util.Collection;
 import java.util.List;
@@ -56,4 +58,6 @@ public interface IProfileTpService extends IService<ProfileTp> {
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
 	ProfileTpVo queryByGoodsId(Long goodsId);
+
+    boolean commitmentSealUpload(CommitmentSealBo bo);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/IShoppingCartService.java

@@ -55,4 +55,6 @@ public interface IShoppingCartService extends IService<ShoppingCart> {
 	Boolean deleteById(Long id, Long userId);
 
 	Boolean deleteByGoodsId(Long goodsId, Long userId);
+
+	Boolean updateBatchChoice(ShoppingCartEditBo bo);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/IUserProfileService.java

@@ -77,4 +77,6 @@ public interface IUserProfileService extends IService<UserProfile> {
 	Map<String,Object> exportPo(UserProfileQueryBo bo);
 
 	Integer getProfileStatusNum(ConsoleQueryBo bo);
+
+    UserProfile getByOrderGoodsIdNoTenant(Long orderGoodsId);
 }

+ 13 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/ActivityAdvertisingServiceImpl.java

@@ -9,10 +9,14 @@ import com.zhongzheng.modules.base.bo.ActivityAdvertisingAddBo;
 import com.zhongzheng.modules.base.bo.ActivityAdvertisingEditBo;
 import com.zhongzheng.modules.base.bo.ActivityAdvertisingQueryBo;
 import com.zhongzheng.modules.base.domain.ActivityAdvertising;
+import com.zhongzheng.modules.base.domain.ActivityAdvertisingLocation;
 import com.zhongzheng.modules.base.domain.Certificate;
 import com.zhongzheng.modules.base.mapper.ActivityAdvertisingMapper;
+import com.zhongzheng.modules.base.service.IActivityAdvertisingLocationService;
 import com.zhongzheng.modules.base.service.IActivityAdvertisingService;
+import com.zhongzheng.modules.base.service.IApplyAreasService;
 import com.zhongzheng.modules.base.vo.ActivityAdvertisingVo;
+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;
@@ -33,6 +37,9 @@ import java.util.stream.Collectors;
 @Service
 public class ActivityAdvertisingServiceImpl extends ServiceImpl<ActivityAdvertisingMapper, ActivityAdvertising> implements IActivityAdvertisingService {
 
+    @Autowired
+    private  IActivityAdvertisingLocationService iActivityAdvertisingLocationService;
+
     @Override
     public ActivityAdvertisingVo queryById(Long id){
         ActivityAdvertising db = this.baseMapper.selectById(id);
@@ -115,6 +122,12 @@ public class ActivityAdvertisingServiceImpl extends ServiceImpl<ActivityAdvertis
                 .eq(ActivityAdvertising::getAdvName,entity.getAdvName()).ne(ActivityAdvertising::getStatus,-1)
                 .last("limit 1"));
         if (Validator.isNotNull(info)) {
+            ActivityAdvertisingLocation location = iActivityAdvertisingLocationService.getOne(new LambdaQueryWrapper<ActivityAdvertisingLocation>()
+                    .eq(ActivityAdvertisingLocation::getLocationId,info.getLocationId()).ne(ActivityAdvertisingLocation::getStatus,-1)
+                    .last("limit 1"));
+            if(Validator.isEmpty(location)){
+                return false;
+            }
             if(Validator.isNotEmpty(entity.getId())){
                 if(entity.getId().longValue() != info.getId().longValue()){
                     return true;

+ 1 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/CertificateCommonServiceImpl.java

@@ -2,7 +2,7 @@ package com.zhongzheng.modules.base.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.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -29,7 +29,6 @@ import java.util.stream.Collectors;
  * @date 2022-06-07
  */
 @Service
-@DS("slave")
 public class CertificateCommonServiceImpl extends ServiceImpl<CertificateCommonMapper, CertificateCommon> implements ICertificateCommonService {
 
     @Override

+ 1 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/CertificateServiceImpl.java

@@ -3,7 +3,7 @@ package com.zhongzheng.modules.base.service.impl;
 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.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -31,7 +31,6 @@ import java.util.stream.Collectors;
  * @date 2021-10-08
  */
 @Service
-@DS("slave")
 public class CertificateServiceImpl extends ServiceImpl<CertificateMapper, Certificate> implements ICertificateService {
 
     @Override

+ 789 - 243
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/CertificateTpServiceImpl.java

@@ -3,9 +3,11 @@ package com.zhongzheng.modules.base.service.impl;
 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.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
@@ -25,20 +27,38 @@ import com.zhongzheng.modules.base.mapper.CertificateTpMapper;
 import com.zhongzheng.modules.base.service.ICertificateTpService;
 import com.zhongzheng.modules.base.vo.CertificatePhotoVo;
 import com.zhongzheng.modules.base.vo.CertificateTpVo;
+import com.zhongzheng.modules.course.bo.CourseMenuQueryBo;
+import com.zhongzheng.modules.course.mapper.CourseMenuMapper;
+import com.zhongzheng.modules.course.service.ICourseMenuService;
+import com.zhongzheng.modules.course.service.ICourseModuleService;
 import com.zhongzheng.modules.course.vo.CourseChapterVo;
+import com.zhongzheng.modules.course.vo.CourseMenuVo;
+import com.zhongzheng.modules.course.vo.CourseModuleVo;
+import com.zhongzheng.modules.course.vo.CourseVo;
+import com.zhongzheng.modules.course.service.IMajorService;
+import com.zhongzheng.modules.course.vo.*;
+import com.zhongzheng.modules.goods.bo.GoodsCourseQueryBo;
+import com.zhongzheng.modules.goods.service.IGoodsCourseService;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
 import com.zhongzheng.modules.grade.domain.ClassGradeUser;
 import com.zhongzheng.modules.grade.service.IClassGradeUserService;
+import com.zhongzheng.modules.grade.service.impl.ClassGradeServiceImpl;
+import com.zhongzheng.modules.order.domain.OrderGoods;
+import com.zhongzheng.modules.order.service.IOrderGoodsService;
+import com.zhongzheng.modules.system.domain.SysOldOrg;
 import com.zhongzheng.modules.user.bo.UserCertificateAddBo;
 import com.zhongzheng.modules.user.bo.UserStudyRecordQueryBo;
+import com.zhongzheng.modules.user.domain.UserCertificate;
 import com.zhongzheng.modules.user.service.IUserCertificateService;
 import com.zhongzheng.modules.user.service.IUserService;
 import com.zhongzheng.modules.user.service.IUserStudyRecordService;
 import com.zhongzheng.modules.user.vo.UserStudyRecordVo;
 import com.zhongzheng.modules.user.vo.UserVo;
 import org.apache.commons.lang3.ArrayUtils;
+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;
@@ -47,6 +67,7 @@ import javax.imageio.ImageIO;
 import java.awt.*;
 import java.awt.image.BufferedImage;
 import java.io.*;
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -61,9 +82,10 @@ import java.util.stream.Collectors;
  * @date 2022-02-16
  */
 @Service
-@DS("slave")
 public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, CertificateTp> implements ICertificateTpService {
 
+    private static Logger log = LoggerFactory.getLogger(CertificateTpServiceImpl.class);
+
     @Autowired
     private IGoodsService iGoodsService;
     @Autowired
@@ -80,7 +102,23 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
     @Autowired
     private RedisCache redisCache;
 
+    @Autowired
+    private CourseMenuMapper courseMenuMapper;
+
+    @Autowired
+    private IGoodsCourseService iGoodsCourseService;
+
+    @Autowired
+    private ICourseMenuService iCourseMenuService;
+
+    @Autowired
+    private ICourseModuleService iCourseModuleService;
+
+    @Autowired
+    private IOrderGoodsService iOrderGoodsService;
 
+    @Autowired
+    private IMajorService iMajorService;
     @Value("${certificate.host}")
     private String CERTIFICATE_HOST;
 
@@ -155,263 +193,445 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
         if(Validator.isEmpty(bo.getUserId())||Validator.isEmpty(bo.getGradeId())||Validator.isEmpty(bo.getGoodsId())){
             throw new CustomException("数据错误");
         }
+        UserCertificate userCertificate = iUserCertificateService.getOne(new LambdaQueryWrapper<UserCertificate>()
+                .eq(UserCertificate::getUserId, bo.getUserId())
+                .eq(UserCertificate::getGradeId,bo.getGradeId()).last("limit 1"));
+        if(Validator.isNotEmpty(userCertificate)){
+            System.out.println("已存在证书");
+            log.info("已存在证书" + bo.getUserId()+"-"+bo.getGradeId(), "");
+            return null;
+        }
+        bo.setPageSize(null);
+        bo.setPageNum(null);
         GoodsVo goodsVo = iGoodsService.selectDetail(bo.getGoodsId());
         //获取培训开始时间
         UserStudyRecordQueryBo studyRecordQueryBo = new UserStudyRecordQueryBo();
         studyRecordQueryBo.setUserId(bo.getUserId());
         studyRecordQueryBo.setGoodsId(bo.getGoodsId());
         studyRecordQueryBo.setGradeId(bo.getGradeId());
-        UserStudyRecordVo studyRecordVo = iUserStudyRecordService.queryLast(studyRecordQueryBo);
+        UserStudyRecordVo studyRecordVo = iUserStudyRecordService.queryFirst(studyRecordQueryBo);
         //获取培训结束时间
-        ClassGradeUser classGradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>().eq(ClassGradeUser::getUserId, bo.getUserId()).eq(ClassGradeUser::getGradeId,bo.getGradeId()).last("limit 1"));
-        //获取章列表
-        List<CourseChapterVo> chapterList =  iClassGradeUserService.findChapterList(bo);
+        ClassGradeUser classGradeUser = iClassGradeUserService.getOne(new LambdaQueryWrapper<ClassGradeUser>()
+                .eq(ClassGradeUser::getUserId, bo.getUserId())
+                .eq(ObjectUtils.isNotNull(bo.getOrderGoodsId()),ClassGradeUser::getOrderGoodsId, bo.getOrderGoodsId())
+                .eq(ClassGradeUser::getGradeId,bo.getGradeId()).last("limit 1"));
         UserVo userVo = iUserService.queryById(bo.getUserId());
-        if(Validator.isNotEmpty(goodsVo.getCertificateTpId())){
-    //        String[] s = goodsVo.getCertificateIds().split(",");
-            List<Long> tpIds = new ArrayList<>();
+        if(Validator.isNotEmpty(goodsVo.getMoreCertificateStatus())&&goodsVo.getMoreCertificateStatus()==1){
+            //获取章列表
+            List<CourseChapterVo> chapterList =  iClassGradeUserService.findChapterList(bo);
+            BigDecimal totalTime = new BigDecimal(0);
+            BigDecimal publicTotalTime = new BigDecimal(0);
+            for(CourseChapterVo chapterVo : chapterList){
+                if(Validator.isEmpty(chapterVo.getCommonSign())||chapterVo.getCommonSign()==0){
+                    totalTime=totalTime.add(new BigDecimal(courseMenuMapper.countChapterTotalTime(chapterVo.getChapterId())));
+                }else if(chapterVo.getCommonSign()==1){
+                    publicTotalTime=publicTotalTime.add(new BigDecimal(courseMenuMapper.countChapterTotalTime(chapterVo.getChapterId())));
+                }
+
+            }
+            goodsVo.setClassHours(totalTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP));
+            goodsVo.setPublicClassHours(publicTotalTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP));
+            if(Validator.isNotEmpty(goodsVo.getCertificateTpId())){
+                //        String[] s = goodsVo.getCertificateIds().split(",");
+                List<Long> tpIds = new ArrayList<>();
            /* for(String each : s) {
                 tpIds.add(Long.valueOf(each));
             }*/
-            tpIds.add(goodsVo.getCertificateTpId());
-            CertificateTpQueryBo queryBo = new CertificateTpQueryBo();
-            queryBo.setTpIds(tpIds);
-            queryBo.setStatus(new ArrayList<Integer>(Arrays.asList(1)));
-            List<CertificateTpVo> list = selectListByBo(queryBo);
-            String nowDate = DateUtils.getDate();
-            for(CertificateTpVo tpVo : list){
-                if("certificate01".equals(tpVo.getKeyValue())){
-                    CertificatePhotoVo vo = new CertificatePhotoVo();
-                    String code = "XYZC"+nowDate.substring(2, 4)+"01"+getCertificateCode();
-                    vo.setCode(code);
-                    vo.setRealname(userVo.getRealname());
-                    vo.setIdCard(userVo.getIdCard());
-                    String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
-                    vo.setYear(date.substring(0, 4));
-                    vo.setType("专业");
-                    vo.setMajor("网络班");
-                    vo.setClassHours(goodsVo.getClassHours()+"");
-                    vo.setDateY(nowDate.substring(0, 4));
-                    vo.setDateM(nowDate.substring(5, 7));
-                    vo.setDateD(nowDate.substring(8, 10));
-                    vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
-                    vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
-                    List<String> chapterListTxt = changeChapterList(chapterList);
-                    vo.setChapterList(chapterListTxt);
-                    String ossPath = drawPic(vo);
-                    UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath);
-                    iUserCertificateService.insertByAddBo(addBo);
+                tpIds.add(goodsVo.getCertificateTpId());
+                CertificateTpQueryBo queryBo = new CertificateTpQueryBo();
+                queryBo.setTpIds(tpIds);
+                queryBo.setStatus(new ArrayList<Integer>(Arrays.asList(1)));
+                List<CertificateTpVo> list = selectListByBo(queryBo);
 
+                for(CertificateTpVo tpVo : list){
+                    drawCertificate(tpVo,goodsVo,bo,userVo,studyRecordVo,classGradeUser,chapterList,null);
                 }
-                else if("certificate02".equals(tpVo.getKeyValue())){
-                    CertificatePhotoVo vo = new CertificatePhotoVo();
-                    String code = "XYZC"+nowDate.substring(2, 4)+"03"+getCertificateCode();
-                    vo.setCode(code);
-                    vo.setRealname(userVo.getRealname());
-                    vo.setIdCard(userVo.getIdCard());
-                    String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
-                    vo.setYear(date.substring(0, 4));
-                    vo.setType("选修");
-                    vo.setMajor("网络班");
-                    vo.setClassHours(goodsVo.getClassHours()+"");
-                    vo.setDateY(nowDate.substring(0, 4));
-                    vo.setDateM(nowDate.substring(5, 7));
-                    vo.setDateD(nowDate.substring(8, 10));
-                    vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
-                    vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
-                    List<String> chapterListTxt = changeChapterList(chapterList);
-                    vo.setChapterList(chapterListTxt);
-                    String ossPath = drawPic(vo);
-                    UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath);
-                    iUserCertificateService.insertByAddBo(addBo);
-
-                }
-                else if("certificate03".equals(tpVo.getKeyValue())){
-                    CertificatePhotoVo vo = new CertificatePhotoVo();
-                    String code = "XYPX01YJ"+nowDate.substring(0, 4)+getCertificateCode();
-                    vo.setCode(code);
-                    vo.setRealname(userVo.getRealname());
-                    vo.setIdCard(userVo.getIdCard());
-                    String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
-                    vo.setYear(date.substring(0, 4));
-                    vo.setType("选修");
-                    vo.setMajor("网络班");
-                    String sex = "男";
-                    if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
-                        sex = "女";
-                    }
-                    vo.setSex(sex);
-                    vo.setClassHours(goodsVo.getClassHours()+"");
-                    vo.setDateY(nowDate.substring(0, 4));
-                    vo.setDateM(nowDate.substring(5, 7));
-                    vo.setDateD(nowDate.substring(8, 10));
-                    vo.setMajor("一级建造师继续教育培训");
-                    vo.setRemark1("其中必修");
-                    vo.setRemark2("课 "+goodsVo.getClassHours()+" 学时,测试成绩合格。");
-                    vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
-                    vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
-                    List<String> chapterListTxt = changeChapterList(chapterList);
-                    vo.setChapterList(chapterListTxt);
-                    String ossPath =drawPicOneBuild(vo);
-                    UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath);
-                    iUserCertificateService.insertByAddBo(addBo);
-                }
-                else if("certificate04".equals(tpVo.getKeyValue())){
-                    CertificatePhotoVo vo = new CertificatePhotoVo();
-                    String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
-                    vo.setCode(code);
-                    vo.setRealname(userVo.getRealname());
-                    vo.setIdCard(userVo.getIdCard());
-                    String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
-                    vo.setYear(date.substring(0, 4));
-                    vo.setType("选修");
-                    vo.setMajor("网络班");
-                    String sex = "男";
-                    if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
-                        sex = "女";
-                    }
-                    vo.setSex(sex);
-                    vo.setClassHours(goodsVo.getClassHours()+"");
-                    vo.setDateY(nowDate.substring(0, 4));
-                    vo.setDateM(nowDate.substring(5, 7));
-                    vo.setDateD(nowDate.substring(8, 10));
-                    vo.setMajor("一级建造师继续教育培训");
-                    vo.setRemark1("其中建");
-                    vo.setRemark2("筑工程课 "+goodsVo.getClassHours()+" 学时,测试成绩合格。");
-                    vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
-                    vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
-                    List<String> chapterListTxt = changeChapterList(chapterList);
-                    vo.setChapterList(chapterListTxt);
-                    String ossPath =drawPicOneBuild(vo);
-                    UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath);
-                    iUserCertificateService.insertByAddBo(addBo);
-                }
-                else if("certificate05".equals(tpVo.getKeyValue())){
-                    CertificatePhotoVo vo = new CertificatePhotoVo();
-                    String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
-                    vo.setCode(code);
-                    vo.setRealname(userVo.getRealname());
-                    vo.setIdCard(userVo.getIdCard());
-                    String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
-                    vo.setYear(date.substring(0, 4));
-                    vo.setType("选修");
-                    vo.setMajor("网络班");
-                    String sex = "男";
-                    if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
-                        sex = "女";
-                    }
-                    vo.setSex(sex);
-                    vo.setClassHours(goodsVo.getClassHours()+"");
-                    vo.setDateY(nowDate.substring(0, 4));
-                    vo.setDateM(nowDate.substring(5, 7));
-                    vo.setDateD(nowDate.substring(8, 10));
-                    vo.setMajor("一级建造师继续教育培训");
-                    vo.setRemark1("其中机");
-                    vo.setRemark2("电工程课 "+goodsVo.getClassHours()+" 学时,测试成绩合格。");
-                    vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
-                    vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
-                    List<String> chapterListTxt = changeChapterList(chapterList);
-                    vo.setChapterList(chapterListTxt);
-                    String ossPath =drawPicOneBuild(vo);
-                    UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath);
-                    iUserCertificateService.insertByAddBo(addBo);
-                }
-                else if("certificate06".equals(tpVo.getKeyValue())){
-                    CertificatePhotoVo vo = new CertificatePhotoVo();
-                    String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
-                    vo.setCode(code);
-                    vo.setRealname(userVo.getRealname());
-                    vo.setIdCard(userVo.getIdCard());
-                    String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
-                    vo.setYear(date.substring(0, 4));
-                    vo.setType("选修");
-                    vo.setMajor("网络班");
-                    String sex = "男";
-                    if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
-                        sex = "女";
-                    }
-                    vo.setSex(sex);
-                    vo.setClassHours(goodsVo.getClassHours()+"");
-                    vo.setDateY(nowDate.substring(0, 4));
-                    vo.setDateM(nowDate.substring(5, 7));
-                    vo.setDateD(nowDate.substring(8, 10));
-                    vo.setMajor("一级建造师继续教育培训");
-                    vo.setRemark1("其中市");
-                    vo.setRemark2("政公用工程课 "+goodsVo.getClassHours()+" 学时,测试成绩合格。");
-                    vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
-                    vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
-                    List<String> chapterListTxt = changeChapterList(chapterList);
-                    vo.setChapterList(chapterListTxt);
-                    String ossPath =drawPicOneBuild(vo);
-                    UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath);
-                    iUserCertificateService.insertByAddBo(addBo);
-                }
-                else if("certificate07".equals(tpVo.getKeyValue())){
-                    CertificatePhotoVo vo = new CertificatePhotoVo();
-                    String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
-                    vo.setCode(code);
-                    vo.setRealname(userVo.getRealname());
-                    vo.setIdCard(userVo.getIdCard());
-                    String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
-                    vo.setYear(date.substring(0, 4));
-                    vo.setType("选修");
-                    vo.setMajor("网络班");
-                    String sex = "男";
-                    if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
-                        sex = "女";
+            }
+        }
+        else if(Validator.isNotEmpty(goodsVo.getMoreCertificateStatus())&&goodsVo.getMoreCertificateStatus()==2){
+            GoodsCourseQueryBo courseQueryBo = new GoodsCourseQueryBo();
+            courseQueryBo.setGoodsId(goodsVo.getGoodsId());
+            List<CourseVo> courseVoList = iGoodsCourseService.selectList(courseQueryBo);
+            for(CourseVo courseVo : courseVoList){
+                CourseMenuQueryBo menuQueryBo = new CourseMenuQueryBo();
+                menuQueryBo.setCourseId(courseVo.getCourseId());
+                menuQueryBo.setType(1);
+                List<CourseMenuVo> menuVoList = iCourseMenuService.queryList(menuQueryBo);
+                for(CourseMenuVo menuVo : menuVoList){
+                    bo.setModuleId(menuVo.getMenuId());
+                    bo.setMoreCertificateStatus(goodsVo.getMoreCertificateStatus());
+                    CourseModuleVo moduleVo = iCourseModuleService.queryById(bo.getModuleId());
+                    //获取章列表
+                    List<CourseChapterVo> chapterList =  iClassGradeUserService.findChapterList(bo);
+                    BigDecimal totalTime = new BigDecimal(0);
+                    for(CourseChapterVo chapterVo : chapterList){
+                        totalTime=totalTime.add(new BigDecimal(courseMenuMapper.countChapterTotalTime(chapterVo.getChapterId())));
                     }
-                    vo.setSex(sex);
-                    vo.setClassHours(goodsVo.getClassHours()+"");
-                    vo.setDateY(nowDate.substring(0, 4));
-                    vo.setDateM(nowDate.substring(5, 7));
-                    vo.setDateD(nowDate.substring(8, 10));
-                    vo.setMajor("一级建造师继续教育培训");
-                    vo.setRemark1("其中公");
-                    vo.setRemark2("路工程课 "+goodsVo.getClassHours()+" 学时,测试成绩合格。");
-                    vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
-                    vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
-                    List<String> chapterListTxt = changeChapterList(chapterList);
-                    vo.setChapterList(chapterListTxt);
-                    String ossPath =drawPicOneBuild(vo);
-                    UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath);
-                    iUserCertificateService.insertByAddBo(addBo);
-                }
-                else if("certificate08".equals(tpVo.getKeyValue())){
-                    CertificatePhotoVo vo = new CertificatePhotoVo();
-                    String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
-                    vo.setCode(code);
-                    vo.setRealname(userVo.getRealname());
-                    vo.setIdCard(userVo.getIdCard());
-                    String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
-                    vo.setYear(date.substring(0, 4));
-                    vo.setType("选修");
-                    vo.setMajor("网络班");
-                    String sex = "男";
-                    if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
-                        sex = "女";
+                    goodsVo.setClassHours(totalTime.divide(new BigDecimal(45*60),BigDecimal.ROUND_HALF_UP));
+                    List<Long> tpIds = new ArrayList<>();
+                    if(Validator.isNotEmpty(moduleVo.getCertificateTpId())){
+                        tpIds.add(moduleVo.getCertificateTpId());
+                        CertificateTpQueryBo queryBo = new CertificateTpQueryBo();
+                        queryBo.setTpIds(tpIds);
+                        queryBo.setStatus(new ArrayList<Integer>(Arrays.asList(1)));
+                        List<CertificateTpVo> list = selectListByBo(queryBo);
+
+                        for(CertificateTpVo tpVo : list){
+                            drawCertificate(tpVo,goodsVo,bo,userVo,studyRecordVo,classGradeUser,chapterList,bo.getModuleId());
+                        }
                     }
-                    vo.setSex(sex);
-                    vo.setClassHours(goodsVo.getClassHours()+"");
-                    vo.setDateY(nowDate.substring(0, 4));
-                    vo.setDateM(nowDate.substring(5, 7));
-                    vo.setDateD(nowDate.substring(8, 10));
-                    vo.setMajor("一级建造师继续教育培训");
-                    vo.setRemark1("其中水");
-                    vo.setRemark2("利水电课 "+goodsVo.getClassHours()+" 学时,测试成绩合格。");
-                    vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
-                    vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
-                    List<String> chapterListTxt = changeChapterList(chapterList);
-                    vo.setChapterList(chapterListTxt);
-                    String ossPath =drawPicOneBuild(vo);
-                    UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath);
-                    iUserCertificateService.insertByAddBo(addBo);
                 }
             }
         }
         return null;
     }
 
-    private UserCertificateAddBo mergeData(ClassGradeUserQueryBo bo, GoodsVo goodsVo,CertificatePhotoVo vo,Long certificateTpId,String certificatePath){
+    @Override
+    public String makeBatchCertificatePhoto(ClassGradeUserQueryBo bo) {
+        List<ClassGradeUser> list = iClassGradeUserService.list(new LambdaQueryWrapper<ClassGradeUser>()
+                .eq(ClassGradeUser::getPeriodStatus, 1).ge(ClassGradeUser::getCreateTime,bo.getClassStartTime()));
+        for(ClassGradeUser gradeUser : list){
+            ClassGradeUserQueryBo queryBo = new ClassGradeUserQueryBo();
+            queryBo.setGradeId(gradeUser.getGradeId());
+            queryBo.setUserId(gradeUser.getUserId());
+            queryBo.setOrderGoodsId(gradeUser.getOrderGoodsId());
+            OrderGoods orderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>()
+                    .eq(OrderGoods::getOrderGoodsId, gradeUser.getOrderGoodsId()));
+            queryBo.setGoodsId(orderGoods.getGoodsId());
+            System.out.println("生成证书");
+            System.out.println(JSON.toJSONString(queryBo));
+            makeCertificatePhoto(queryBo);
+        }
+        return null;
+    }
+
+    private void  drawCertificate(CertificateTpVo tpVo,GoodsVo goodsVo,ClassGradeUserQueryBo bo,UserVo userVo,UserStudyRecordVo studyRecordVo,ClassGradeUser classGradeUser,List<CourseChapterVo> chapterList,Long moduleId){
+        String nowDate = DateUtils.getDate();
+        if("certificate01".equals(tpVo.getKeyValue())){
+            CertificatePhotoVo vo = new CertificatePhotoVo();
+            String code = "XYZC"+nowDate.substring(2, 4)+"01"+getCertificateCode();
+            vo.setCode(code);
+            vo.setRealname(userVo.getRealname());
+            vo.setIdCard(userVo.getIdCard());
+            String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+            vo.setYear(date.substring(0, 4));
+            vo.setType("专业");
+            vo.setMajor("网络班");
+            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setDateY(nowDate.substring(0, 4));
+            vo.setDateM(nowDate.substring(5, 7));
+            vo.setDateD(nowDate.substring(8, 10));
+            vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
+            vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
+            List<String> chapterListTxt = changeChapterList(chapterList);
+            vo.setChapterList(chapterListTxt);
+            String ossPath = drawPic(vo);
+            UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
+            iUserCertificateService.insertByAddBo(addBo);
+
+        }
+        else if("certificate02".equals(tpVo.getKeyValue())){
+            CertificatePhotoVo vo = new CertificatePhotoVo();
+            String code = "XYZC"+nowDate.substring(2, 4)+"03"+getCertificateCode();
+            vo.setCode(code);
+            vo.setRealname(userVo.getRealname());
+            vo.setIdCard(userVo.getIdCard());
+            String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+            vo.setYear(date.substring(0, 4));
+            vo.setType("选修");
+            vo.setMajor("网络班");
+            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setDateY(nowDate.substring(0, 4));
+            vo.setDateM(nowDate.substring(5, 7));
+            vo.setDateD(nowDate.substring(8, 10));
+            vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
+            vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
+            List<String> chapterListTxt = changeChapterList(chapterList);
+            vo.setChapterList(chapterListTxt);
+            String ossPath = drawPic(vo);
+            UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
+            iUserCertificateService.insertByAddBo(addBo);
+
+        }
+        else if("certificate03".equals(tpVo.getKeyValue())){
+            CertificatePhotoVo vo = new CertificatePhotoVo();
+            String code = "XYPX01YJ"+nowDate.substring(0, 4)+getCertificateCode();
+            vo.setCode(code);
+            vo.setRealname(userVo.getRealname());
+            vo.setIdCard(userVo.getIdCard());
+            String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+            vo.setYear(date.substring(0, 4));
+            vo.setType("选修");
+            vo.setMajor("网络班");
+            String sex = "男";
+            if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
+                sex = "女";
+            }
+            vo.setSex(sex);
+            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setDateY(nowDate.substring(0, 4));
+            vo.setDateM(nowDate.substring(5, 7));
+            vo.setDateD(nowDate.substring(8, 10));
+            vo.setMajor("一级建造师继续教育培训");
+            vo.setRemark1("其中必修");
+            vo.setRemark2("课 "+goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+" 学时,测试成绩合格。");
+            vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
+            vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
+            List<String> chapterListTxt = changeChapterList(chapterList);
+            vo.setChapterList(chapterListTxt);
+            String ossPath =drawPicOneBuild(vo);
+            UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
+            iUserCertificateService.insertByAddBo(addBo);
+        }
+        else if("certificate04".equals(tpVo.getKeyValue())){
+            CertificatePhotoVo vo = new CertificatePhotoVo();
+            String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
+            vo.setCode(code);
+            vo.setRealname(userVo.getRealname());
+            vo.setIdCard(userVo.getIdCard());
+            String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+            vo.setYear(date.substring(0, 4));
+            vo.setType("选修");
+            vo.setMajor("网络班");
+            String sex = "男";
+            if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
+                sex = "女";
+            }
+            vo.setSex(sex);
+            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setDateY(nowDate.substring(0, 4));
+            vo.setDateM(nowDate.substring(5, 7));
+            vo.setDateD(nowDate.substring(8, 10));
+            vo.setMajor("一级建造师继续教育培训");
+            vo.setRemark1("其中建");
+            vo.setRemark2("筑工程课 "+goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+" 学时,测试成绩合格。");
+            vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
+            vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
+            List<String> chapterListTxt = changeChapterList(chapterList);
+            vo.setChapterList(chapterListTxt);
+            String ossPath =drawPicOneBuild(vo);
+            UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
+            iUserCertificateService.insertByAddBo(addBo);
+        }
+        else if("certificate05".equals(tpVo.getKeyValue())){
+            CertificatePhotoVo vo = new CertificatePhotoVo();
+            String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
+            vo.setCode(code);
+            vo.setRealname(userVo.getRealname());
+            vo.setIdCard(userVo.getIdCard());
+            String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+            vo.setYear(date.substring(0, 4));
+            vo.setType("选修");
+            vo.setMajor("网络班");
+            String sex = "男";
+            if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
+                sex = "女";
+            }
+            vo.setSex(sex);
+            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setDateY(nowDate.substring(0, 4));
+            vo.setDateM(nowDate.substring(5, 7));
+            vo.setDateD(nowDate.substring(8, 10));
+            vo.setMajor("一级建造师继续教育培训");
+            vo.setRemark1("其中机");
+            vo.setRemark2("电工程课 "+goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+" 学时,测试成绩合格。");
+            vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
+            vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
+            List<String> chapterListTxt = changeChapterList(chapterList);
+            vo.setChapterList(chapterListTxt);
+            String ossPath =drawPicOneBuild(vo);
+            UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
+            iUserCertificateService.insertByAddBo(addBo);
+        }
+        else if("certificate06".equals(tpVo.getKeyValue())){
+            CertificatePhotoVo vo = new CertificatePhotoVo();
+            String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
+            vo.setCode(code);
+            vo.setRealname(userVo.getRealname());
+            vo.setIdCard(userVo.getIdCard());
+            String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+            vo.setYear(date.substring(0, 4));
+            vo.setType("选修");
+            vo.setMajor("网络班");
+            String sex = "男";
+            if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
+                sex = "女";
+            }
+            vo.setSex(sex);
+            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setDateY(nowDate.substring(0, 4));
+            vo.setDateM(nowDate.substring(5, 7));
+            vo.setDateD(nowDate.substring(8, 10));
+            vo.setMajor("一级建造师继续教育培训");
+            vo.setRemark1("其中市");
+            vo.setRemark2("政公用工程课 "+goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+" 学时,测试成绩合格。");
+            vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
+            vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
+            List<String> chapterListTxt = changeChapterList(chapterList);
+            vo.setChapterList(chapterListTxt);
+            String ossPath =drawPicOneBuild(vo);
+            UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
+            iUserCertificateService.insertByAddBo(addBo);
+        }
+        else if("certificate07".equals(tpVo.getKeyValue())){
+            CertificatePhotoVo vo = new CertificatePhotoVo();
+            String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
+            vo.setCode(code);
+            vo.setRealname(userVo.getRealname());
+            vo.setIdCard(userVo.getIdCard());
+            String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+            vo.setYear(date.substring(0, 4));
+            vo.setType("选修");
+            vo.setMajor("网络班");
+            String sex = "男";
+            if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
+                sex = "女";
+            }
+            vo.setSex(sex);
+            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setDateY(nowDate.substring(0, 4));
+            vo.setDateM(nowDate.substring(5, 7));
+            vo.setDateD(nowDate.substring(8, 10));
+            vo.setMajor("一级建造师继续教育培训");
+            vo.setRemark1("其中公");
+            vo.setRemark2("路工程课 "+goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+" 学时,测试成绩合格。");
+            vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
+            vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
+            List<String> chapterListTxt = changeChapterList(chapterList);
+            vo.setChapterList(chapterListTxt);
+            String ossPath =drawPicOneBuild(vo);
+            UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
+            iUserCertificateService.insertByAddBo(addBo);
+        }
+        else if("certificate08".equals(tpVo.getKeyValue())){
+            CertificatePhotoVo vo = new CertificatePhotoVo();
+            String code = "XYPX02YJ"+nowDate.substring(0, 4)+getCertificateCode();
+            vo.setCode(code);
+            vo.setRealname(userVo.getRealname());
+            vo.setIdCard(userVo.getIdCard());
+            String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+            vo.setYear(date.substring(0, 4));
+            vo.setType("选修");
+            vo.setMajor("网络班");
+            String sex = "男";
+            if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
+                sex = "女";
+            }
+            vo.setSex(sex);
+            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setDateY(nowDate.substring(0, 4));
+            vo.setDateM(nowDate.substring(5, 7));
+            vo.setDateD(nowDate.substring(8, 10));
+            vo.setMajor("一级建造师继续教育培训");
+            vo.setRemark1("其中水");
+            vo.setRemark2("利水电课 "+goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+" 学时,测试成绩合格。");
+            vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
+            vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
+            List<String> chapterListTxt = changeChapterList(chapterList);
+            vo.setChapterList(chapterListTxt);
+            String ossPath =drawPicOneBuild(vo);
+            UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
+            iUserCertificateService.insertByAddBo(addBo);
+        }
+        else if("certificate09".equals(tpVo.getKeyValue())){
+            CertificatePhotoVo vo = new CertificatePhotoVo();
+            if(Validator.isEmpty(goodsVo.getMajorId())){
+                throw new CustomException("生成证书专业缺失");
+            }
+            if(Validator.isEmpty(userVo.getOneInchPhotos())){
+                throw new CustomException("生成证书一寸照片缺失");
+            }
+            MajorVo majorVo = iMajorService.queryById(goodsVo.getMajorId());
+            String onePhoto = userVo.getOneInchPhotos();
+            String code = "XYSGXC"+nowDate.substring(0, 4)+getCertificateCode();
+            vo.setOneInchPhotos(onePhoto);
+            vo.setCode(code);
+            vo.setRealname(userVo.getRealname());
+            vo.setIdCard(userVo.getIdCard());
+            String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+            vo.setYear(date.substring(0, 4));
+            String sex = "男";
+            if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
+                sex = "女";
+            }
+            vo.setSex(sex);
+            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setPublicClassHours(goodsVo.getPublicClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setDateY(nowDate.substring(0, 4));
+            vo.setDateM(nowDate.substring(5, 7));
+            vo.setDateD(nowDate.substring(8, 10));
+            vo.setMajor(majorVo.getCategoryName());
+            vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
+            vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
+            List<String> chapterListTxt = changeChapterList(chapterList);
+            vo.setChapterList(chapterListTxt);
+            String ossPath =drawPicSGXC(vo);
+            UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
+            iUserCertificateService.insertByAddBo(addBo);
+        }
+        else if("certificate10".equals(tpVo.getKeyValue())){
+            if(Validator.isEmpty(goodsVo.getMajorId())){
+                throw new CustomException("生成证书专业缺失");
+            }
+            MajorVo majorVo = iMajorService.queryById(goodsVo.getMajorId());
+            CertificatePhotoVo vo = new CertificatePhotoVo();
+            String code = "XYEZJJ"+nowDate.substring(0, 4)+getCertificateCode();
+            vo.setCode(code);
+            vo.setRealname(userVo.getRealname());
+            vo.setIdCard(userVo.getIdCard());
+            String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+            vo.setYear(date.substring(0, 4));
+            String sex = "男";
+            if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
+                sex = "女";
+            }
+            vo.setSex(sex);
+            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setDateY(nowDate.substring(0, 4));
+            vo.setDateM(nowDate.substring(5, 7));
+            vo.setDateD(nowDate.substring(8, 10));
+            vo.setMajor(majorVo.getCategoryName());
+            vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
+            vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
+            List<String> chapterListTxt = changeChapterList2(chapterList);
+            vo.setChapterList(chapterListTxt);
+            String ossPath =drawPicErZao(vo);
+            UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
+            iUserCertificateService.insertByAddBo(addBo);
+        }
+        else if("certificate11".equals(tpVo.getKeyValue())){
+            if(Validator.isEmpty(goodsVo.getMajorId())){
+                throw new CustomException("生成证书专业缺失");
+            }
+            MajorVo majorVo = iMajorService.queryById(goodsVo.getMajorId());
+            CertificatePhotoVo vo = new CertificatePhotoVo();
+            String code = "XYEJJJ"+nowDate.substring(0, 4)+getCertificateCode();
+            vo.setCode(code);
+            vo.setRealname(userVo.getRealname());
+            vo.setIdCard(userVo.getIdCard());
+            String date = DateUtils.timestampToDate(goodsVo.getCreateTime());
+            vo.setYear(date.substring(0, 4));
+            String sex = "男";
+            if(Validator.isNotEmpty(userVo.getSex())&&userVo.getSex()==2){
+                sex = "女";
+            }
+            vo.setSex(sex);
+            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            vo.setDateY(nowDate.substring(0, 4));
+            vo.setDateM(nowDate.substring(5, 7));
+            vo.setDateD(nowDate.substring(8, 10));
+            vo.setMajor(majorVo.getCategoryName());
+            vo.setTrainStartTime(studyRecordVo.getFirstStartTime()); //培训开始时间
+            vo.setTrainEndTime(classGradeUser.getPeriodWaitTime());//学时变为待审核时间,也是学习完成时间
+            List<String> chapterListTxt = changeChapterList2(chapterList);
+            vo.setChapterList(chapterListTxt);
+            String ossPath =drawPicErJian(vo);
+            UserCertificateAddBo addBo = mergeData(bo,goodsVo,vo,tpVo.getTpId(),ossPath,moduleId);
+            iUserCertificateService.insertByAddBo(addBo);
+        }
+    }
+
+    private UserCertificateAddBo mergeData(ClassGradeUserQueryBo bo, GoodsVo goodsVo,CertificatePhotoVo vo,Long certificateTpId,String certificatePath,Long moduleId){
         UserCertificateAddBo addBo = new UserCertificateAddBo();
         addBo.setUserId(bo.getUserId());
         addBo.setGoodsId(bo.getGoodsId());
@@ -419,7 +639,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
         addBo.setCertificateTpId(certificateTpId);
         addBo.setCertificateCode(vo.getCode());
         addBo.setCertificatePath(certificatePath);
-        addBo.setClassHours(goodsVo.getClassHours());
+        addBo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP ));
         addBo.setEducationTypeId(goodsVo.getEducationTypeId());
         addBo.setProjectId(goodsVo.getProjectId());
         addBo.setBusinessId(goodsVo.getBusinessId());
@@ -430,13 +650,17 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
         addBo.setTrainStartTime(vo.getTrainStartTime());
         addBo.setTrainEndTime(vo.getTrainEndTime());
         addBo.setChapterStr(ArrayUtils.toString(vo.getChapterList(), ","));
+        addBo.setMoreCertificateStatus(goodsVo.getMoreCertificateStatus());
+        addBo.setModuleId(moduleId);
+        addBo.setPublicClassHours(goodsVo.getPublicClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP ));
+        addBo.setOrderGoodsId(bo.getOrderGoodsId());
         return addBo;
     }
     private String getCertificateCode(){
         Long id = iUserCertificateService.selectMaxId();
         String nowId = Long.toString(id);
         String result = "";
-        result = String.format("%0" + 4 + "d", Integer.parseInt(nowId) + 1);
+        result = String.format("%0" + 5 + "d", Integer.parseInt(nowId) + 1);
         return result;
     }
 
@@ -473,6 +697,57 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
         return chapterListTxt;
     }
 
+    private List<String> changeChapterList2(List<CourseChapterVo> chapterList){
+        List<String> chapterListTxt = new ArrayList<>();
+        for(int i =0; i<chapterList.size(); i++){
+            String numTag = "";
+            if(i==0){
+                numTag = "1. ";
+            }
+            else if(i==1){
+                numTag = "2. ";
+            }
+            else if(i==2){
+                numTag = "3. ";
+            }
+            else if(i==3){
+                numTag = "4. ";
+            }
+            else if(i==4){
+                numTag = "5. ";
+            }
+            else if(i==5){
+                numTag = "6. ";
+            }
+            else if(i==6){
+                numTag = "7. ";
+            }
+            else if(i==7){
+                numTag = "8. ";
+            }
+            else if(i==8){
+                numTag = "9. ";
+            }
+            else if(i==9){
+                numTag = "10. ";
+            }
+            else if(i==10){
+                numTag = "11. ";
+            }
+            else if(i==11){
+                numTag = "12. ";
+            }
+            else if(i==12){
+                numTag = "13. ";
+            }
+            else if(i==13){
+                numTag = "14. ";
+            }
+            chapterListTxt.add(numTag+chapterList.get(i).getName());
+        }
+        return chapterListTxt;
+    }
+
     private String drawPic(CertificatePhotoVo entity){
         Font font = new Font("微软雅黑", Font.PLAIN, 45);// 添加字体的属性设置
         String projectUrl = "D:\\test\\";
@@ -570,9 +845,7 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
             g.drawString(entity.getRemark1(), 1035, 408);
             g.drawString(entity.getRemark2(), 728, 460);
 
-            g.drawString(entity.getDateY(), 707, 677);
-            g.drawString(entity.getDateM(), 783, 677);
-            g.drawString(entity.getDateD(), 835, 677);
+
 
             g.drawString(entity.getDateY(), 945, 677);
             g.drawString(entity.getDateM(), 1019, 677);
@@ -606,6 +879,279 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
         return imgName;
     }
 
+    private  String drawPicSGXC(CertificatePhotoVo entity){
+        Font font = new Font("微软雅黑", Font.PLAIN, 55);// 添加字体的属性设置 微软雅黑
+        Font font2 = new Font("微软雅黑", Font.BOLD, 58);
+        String imgName = null;
+        try {
+            // 加载图片
+            InputStream imgStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("static/004.jpg");
+            //        String imageLocalUrl = projectUrl + "003.jpg";
+            //         BufferedImage imageLocal = ImageIO.read(new File(imageLocalUrl));
+            BufferedImage imageLocal = ImageIO.read(imgStream);
+            // 以本地图片为模板
+            Graphics2D g = imageLocal.createGraphics();
+            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
+            // 设置文本样式
+            g.setFont(font);
+            g.setColor(Color.BLACK);
+
+            InputStream oneInchPhotos =  ossService.getStreamByObject(entity.getOneInchPhotos());
+            BufferedImage oneInchBuffered = ImageIO.read(oneInchPhotos);
+            g.drawImage(oneInchBuffered, 430, 960, 300, 400, null);
+
+
+
+            g.drawString(entity.getCode(), 1235, 1245);
+            g.drawString(entity.getRealname(), 1235, 1011);
+            g.drawString(entity.getIdCard(), 1235, 1126);
+            g.drawString(entity.getMajor(), 1235, 1368);
+/*
+            g.drawString(entity.getDateY(), 780, 365);
+            g.drawString(entity.getDateM(), 905, 365);
+
+            g.drawString(entity.getRemark1(), 1035, 408);
+            g.drawString(entity.getRemark2(), 728, 460);
+*/
+
+            g.drawString(entity.getDateY(), 1332, 2973);
+            g.drawString(entity.getDateM(), 1594, 2973);
+            g.drawString(entity.getDateD(), 1781, 2973);
+
+            g.setFont(font2);
+            g.drawString(entity.getRealname(), 455, 1616);
+            g.drawString(entity.getDateY()+"年"+entity.getDateM()+"月"+entity.getDateD()+"日", 846, 1616);
+            g.drawString("施工现场专业人员", 1508, 1616);
+
+            g.drawString(entity.getDateY(), 311, 1770);
+            g.drawString(String.valueOf(Integer.parseInt(entity.getPublicClassHours())+Integer.parseInt(entity.getClassHours())), 1341, 1770);
+
+            g.drawString(entity.getPublicClassHours(), 311, 1920);
+            g.drawString(entity.getClassHours(), 881, 1920);
+
+            InputStream logoStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("static/001.png");
+            BufferedImage logoBuffered = ImageIO.read(logoStream);
+            g.drawImage(logoBuffered, 1438, 2555, 529, 528, null);
+
+            //二维码
+            String qrTxt = CERTIFICATE_HOST+"pages/certificate/index?code="+entity.getCode();
+            QRCodeWriter qrCodeWriter = new QRCodeWriter();
+            BitMatrix bitMatrix = qrCodeWriter.encode(qrTxt, BarcodeFormat.QR_CODE, 360, 360);
+            BufferedImage qrImage = toBufferedImage(bitMatrix);
+            // 在模板上添加用户二维码(地址,左边距,上边距,图片宽度,图片高度,未知)
+            g.drawImage(qrImage, 324, 2583, 360, 360, null);
+            // 完成模板修改
+            g.dispose();
+            // 获取新文件的地址
+            // 生成新的合成过的用户二维码并写入新图片
+            //        ImageIO.write(imageLocal, "jpg", outputfile);
+            //上传OSS
+            InputStream is =  bufferedImageToInputStream(imageLocal);
+            String ossPath = ossService.uploadInputStream(is,7);
+            if(imgStream!=null){
+                imgStream.close();
+            }
+            return ossPath;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        // 返回给页面的图片地址(因为绝对路径无法访问)
+        //    imgName = Constants.PROJECT_URL + "codeImg/" + userId + ".png";
+
+        return imgName;
+    }
+
+    private  String drawPicErZao(CertificatePhotoVo entity){
+        Font font = new Font("微软雅黑", Font.PLAIN, 31);// 添加字体的属性设置 微软雅黑
+        Font font2 = new Font("微软雅黑", Font.BOLD, 38);
+        String imgName = null;
+        try {
+            // 加载本地图片
+            InputStream imgStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("static/005.jpg");
+            //        String imageLocalUrl = projectUrl + "003.jpg";
+            //         BufferedImage imageLocal = ImageIO.read(new File(imageLocalUrl));
+            BufferedImage imageLocal = ImageIO.read(imgStream);
+            // 以本地图片为模板
+            Graphics2D g = imageLocal.createGraphics();
+            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
+            // 设置文本样式
+            g.setFont(font2);
+            g.setColor(Color.BLACK);
+            g.drawString(entity.getRealname(), 165, 486);
+
+            g.setFont(font);
+
+            g.drawString(entity.getCode(), 169, 236 );
+
+            g.drawString(entity.getRealname(), 126, 696);
+
+            g.drawString(entity.getIdCard(), 298, 696);
+
+            g.drawString("二级注册造价师", 677, 668);
+            if("必修".equals(entity.getMajor())){
+                g.drawString(entity.getMajor(), 768, 718);
+            }else{
+                g.drawString("选修("+entity.getMajor()+")", 677, 718);
+            }
+
+
+            if("必修".equals(entity.getMajor())){
+                g.drawString(entity.getClassHours(), 980, 696);
+                g.drawString("0", 1105, 696);
+            }else{
+                g.drawString("0", 980, 696);
+                g.drawString(entity.getClassHours(), 1105, 696);
+            }
+            Integer startY = 810;
+            Integer j = 0;
+            for(String name : entity.getChapterList()){
+                if(j<6){
+                    g.drawString(name, 300, startY);
+                    startY+=50;
+                }else{
+                    g.drawString("....", 300, startY);
+                    break;
+                }
+                j++;
+            }
+
+            g.drawString(DateUtils.timestampToDateFormat(entity.getTrainStartTime(),"yyyy.MM.dd"), 1214, 666);
+            g.drawString("至", 1279, 705);
+            g.drawString(DateUtils.timestampToDateFormat(entity.getTrainEndTime(),"yyyy.MM.dd"), 1214, 739);
+
+
+            g.drawString(entity.getDateY(), 842, 1967);
+            g.drawString(entity.getDateM(), 979, 1967);
+            g.drawString(entity.getDateD(), 1069, 1967);
+
+            InputStream logoStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("static/001.png");
+            BufferedImage logoBuffered = ImageIO.read(logoStream);
+            g.drawImage(logoBuffered, 1012, 1666, 330, 330, null);
+
+            //二维码
+            String qrTxt = CERTIFICATE_HOST+"pages/certificate/index?code="+entity.getCode();
+            QRCodeWriter qrCodeWriter = new QRCodeWriter();
+            BitMatrix bitMatrix = qrCodeWriter.encode(qrTxt, BarcodeFormat.QR_CODE, 150, 150);
+            BufferedImage qrImage = toBufferedImage(bitMatrix);
+            // 在模板上添加用户二维码(地址,左边距,上边距,图片宽度,图片高度,未知)
+            g.drawImage(qrImage, 1233, 175, 150, 150, null);
+            // 完成模板修改
+            g.dispose();
+            // 获取新文件的地址
+            // 生成新的合成过的用户二维码并写入新图片
+            //        ImageIO.write(imageLocal, "jpg", outputfile);
+            //上传OSS
+            InputStream is =  bufferedImageToInputStream(imageLocal);
+            String ossPath = ossService.uploadInputStream(is,7);
+            if(imgStream!=null){
+                imgStream.close();
+            }
+            return ossPath;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        // 返回给页面的图片地址(因为绝对路径无法访问)
+        //    imgName = Constants.PROJECT_URL + "codeImg/" + userId + ".png";
+
+        return imgName;
+    }
+
+    private  String drawPicErJian(CertificatePhotoVo entity){
+        Font font = new Font("微软雅黑", Font.PLAIN, 31);// 添加字体的属性设置 微软雅黑
+        Font font2 = new Font("微软雅黑", Font.BOLD, 38);
+        String imgName = null;
+        try {
+            // 加载本地图片
+            InputStream imgStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("static/006.jpg");
+            //        String imageLocalUrl = projectUrl + "003.jpg";
+            //         BufferedImage imageLocal = ImageIO.read(new File(imageLocalUrl));
+            BufferedImage imageLocal = ImageIO.read(imgStream);
+            // 以本地图片为模板
+            Graphics2D g = imageLocal.createGraphics();
+            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
+            // 设置文本样式
+            g.setFont(font2);
+            g.setColor(Color.BLACK);
+            g.drawString(entity.getRealname(), 165, 486);
+
+            g.setFont(font);
+
+            g.drawString(entity.getCode(), 169, 236 );
+
+            g.drawString(entity.getRealname(), 126, 696);
+
+            g.drawString(entity.getIdCard(), 298, 696);
+
+            g.drawString("二级注册建造师", 677, 668);
+            if("必修".equals(entity.getMajor())){
+                g.drawString(entity.getMajor(), 768, 718);
+            }else{
+                g.drawString("选修("+entity.getMajor()+")", 677, 718);
+            }
+
+
+            if("必修".equals(entity.getMajor())){
+                g.drawString(entity.getClassHours(), 980, 696);
+                g.drawString("0", 1105, 696);
+            }else{
+                g.drawString("0", 980, 696);
+                g.drawString(entity.getClassHours(), 1105, 696);
+            }
+            Integer startY = 810;
+            Integer j = 0;
+            for(String name : entity.getChapterList()){
+                if(j<14){
+                    g.drawString(name, 300, startY);
+                    startY+=50;
+                }else{
+                    g.drawString("....", 300, startY);
+                    break;
+                }
+                j++;
+            }
+
+            g.drawString(DateUtils.timestampToDateFormat(entity.getTrainStartTime(),"yyyy.MM.dd"), 1214, 666);
+            g.drawString("至", 1279, 705);
+            g.drawString(DateUtils.timestampToDateFormat(entity.getTrainEndTime(),"yyyy.MM.dd"), 1214, 739);
+
+
+            g.drawString(entity.getDateY(), 842, 1967);
+            g.drawString(entity.getDateM(), 979, 1967);
+            g.drawString(entity.getDateD(), 1069, 1967);
+
+            InputStream logoStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("static/001.png");
+            BufferedImage logoBuffered = ImageIO.read(logoStream);
+            g.drawImage(logoBuffered, 1012, 1666, 330, 330, null);
+
+            //二维码
+            String qrTxt = CERTIFICATE_HOST+"pages/certificate/index?code="+entity.getCode();
+            QRCodeWriter qrCodeWriter = new QRCodeWriter();
+            BitMatrix bitMatrix = qrCodeWriter.encode(qrTxt, BarcodeFormat.QR_CODE, 150, 150);
+            BufferedImage qrImage = toBufferedImage(bitMatrix);
+            // 在模板上添加用户二维码(地址,左边距,上边距,图片宽度,图片高度,未知)
+            g.drawImage(qrImage, 1233, 175, 150, 150, null);
+            // 完成模板修改
+            g.dispose();
+            // 获取新文件的地址
+            // 生成新的合成过的用户二维码并写入新图片
+            //        ImageIO.write(imageLocal, "jpg", outputfile);
+            //上传OSS
+            InputStream is =  bufferedImageToInputStream(imageLocal);
+            String ossPath = ossService.uploadInputStream(is,7);
+            if(imgStream!=null){
+                imgStream.close();
+            }
+            return ossPath;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        // 返回给页面的图片地址(因为绝对路径无法访问)
+        //    imgName = Constants.PROJECT_URL + "codeImg/" + userId + ".png";
+
+        return imgName;
+    }
+
+
     public InputStream bufferedImageToInputStream(BufferedImage image){
         ByteArrayOutputStream os = new ByteArrayOutputStream();
         try {

+ 1 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/ProfileFieldServiceImpl.java

@@ -2,7 +2,7 @@ package com.zhongzheng.modules.base.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.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -28,7 +28,6 @@ import java.util.stream.Collectors;
  * @date 2021-11-19
  */
 @Service
-@DS("slave")
 public class ProfileFieldServiceImpl extends ServiceImpl<ProfileFieldMapper, ProfileField> implements IProfileFieldService {
 
     @Override

+ 1 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/ProfileTpBusinessServiceImpl.java

@@ -1,7 +1,7 @@
 package com.zhongzheng.modules.base.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;
@@ -26,7 +26,6 @@ import java.util.stream.Collectors;
  * @date 2021-11-19
  */
 @Service
-@DS("slave")
 public class ProfileTpBusinessServiceImpl extends ServiceImpl<ProfileTpBusinessMapper, ProfileTpBusiness> implements IProfileTpBusinessService {
 
     @Override

+ 53 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/ProfileTpServiceImpl.java

@@ -3,11 +3,14 @@ package com.zhongzheng.modules.base.service.impl;
 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.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 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.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.modules.base.bo.ProfileTpAddBo;
@@ -15,14 +18,18 @@ import com.zhongzheng.modules.base.bo.ProfileTpEditBo;
 import com.zhongzheng.modules.base.bo.ProfileTpQueryBo;
 import com.zhongzheng.modules.base.domain.ProfileTp;
 import com.zhongzheng.modules.base.domain.ProfileTpBusiness;
+import com.zhongzheng.modules.base.domain.UserProfile;
 import com.zhongzheng.modules.base.mapper.ProfileTpMapper;
 import com.zhongzheng.modules.base.service.IProfileTpBusinessService;
 import com.zhongzheng.modules.base.service.IProfileTpService;
+import com.zhongzheng.modules.base.service.IUserProfileService;
 import com.zhongzheng.modules.base.vo.ProfileTpVo;
+import com.zhongzheng.modules.user.bo.CommitmentSealBo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.util.*;
 import java.util.stream.Collectors;
@@ -34,12 +41,14 @@ import java.util.stream.Collectors;
  * @date 2021-11-19
  */
 @Service
-@DS("slave")
 public class ProfileTpServiceImpl extends ServiceImpl<ProfileTpMapper, ProfileTp> implements IProfileTpService {
 
     @Autowired
     private IProfileTpBusinessService iProfileTpBusinessService;
 
+    @Autowired
+    private IUserProfileService iUserProfileService;
+
 
     @Override
     public ProfileTpVo queryById(Long profileTpId){
@@ -167,5 +176,47 @@ public class ProfileTpServiceImpl extends ServiceImpl<ProfileTpMapper, ProfileTp
         }
     }
 
+    @Override
+    public boolean commitmentSealUpload(CommitmentSealBo bo) {
+        // 承诺书校验
+        checkCommitentSeal(bo);
+        UserProfile userProfile = iUserProfileService.getById(bo.getId());
+        if (ObjectUtils.isNull(userProfile)){
+            throw new CustomException("学员资料不存在");
+        }
+        if (!userProfile.getUserId().equals(bo.getUserId())){
+            throw new CustomException("当前学员和资料不匹配");
+        }
+        //替换学员承诺书
+        String keyValue = userProfile.getKeyValue();
+        JSONObject jsonObject = JSONObject.parseObject(keyValue);
+        Map<String, Object> userMap = new HashMap<>();
+        for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
+            userMap.put(entry.getKey(), entry.getValue());
+        }
+        String key = "commitment_seal";
+        JSONObject recentJson = JSONObject.parseObject(userMap.get(key).toString());
+        Map<String, Object> recentMap = new HashMap<>();
+        for (Map.Entry<String, Object> entry : recentJson.entrySet()) {
+            recentMap.put(entry.getKey(), entry.getValue());
+        }
+        if (ObjectUtils.isNotNull(recentMap)){
+            recentMap.put("value",bo.getImageUrl());
+        }else {
+            recentMap.put("fieldKey",key);
+            recentMap.put("value",bo.getImageUrl());
+            recentMap.put("fieldName","承诺书盖章");
+            recentMap.put("status",0);
+        }
+        userMap.put(key,recentMap);
+        String content = JSONObject.toJSONString(userMap);
+        userProfile.setKeyValue(content);
+        return iUserProfileService.updateById(userProfile);
+    }
+
+    private void checkCommitentSeal(CommitmentSealBo bo) {
+
+    }
+
 
 }

+ 26 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/ShoppingCartServiceImpl.java

@@ -3,6 +3,7 @@ package com.zhongzheng.modules.base.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 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;
@@ -20,8 +21,12 @@ import com.zhongzheng.modules.base.domain.ShoppingCart;
 import com.zhongzheng.modules.base.mapper.ShoppingCartMapper;
 import com.zhongzheng.modules.base.service.IShoppingCartService;
 import com.zhongzheng.modules.base.vo.ShoppingCartVo;
+import com.zhongzheng.modules.course.domain.CourseChapter;
 import com.zhongzheng.modules.distribution.domain.DistributionActivity;
 import com.zhongzheng.modules.distribution.service.IDistributionActivityService;
+import com.zhongzheng.modules.grade.bo.ClassGradeQueryBo;
+import com.zhongzheng.modules.grade.service.IClassGradeService;
+import com.zhongzheng.modules.grade.vo.ClassGradeVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -48,6 +53,9 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, Sho
     @Autowired
     private IActivityGoodsPriceService iActivityGoodsPriceService;
 
+    @Autowired
+    private IClassGradeService iClassGradeService;
+
     @Override
     public ShoppingCartVo queryById(Long id){
         ShoppingCart db = this.baseMapper.selectById(id);
@@ -82,6 +90,12 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, Sho
                     item.setDistributionStatus(1);
                 }
             }
+            ClassGradeQueryBo gradeQueryBo = new ClassGradeQueryBo();
+            gradeQueryBo.setGoodsId(item.getGoodsId());
+            gradeQueryBo.setPastDue(1L);
+            List<ClassGradeVo> gradeList = iClassGradeService.getList(gradeQueryBo);
+            item.setGradeList(gradeList);
+
         });
         return shoppingCartVos;
     }
@@ -174,6 +188,18 @@ public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, Sho
         return this.remove(new LambdaQueryWrapper<ShoppingCart>().eq(ShoppingCart::getUserId,userId).eq(ShoppingCart::getGoodsId,goodsId));
     }
 
+    @Override
+    public Boolean updateBatchChoice(ShoppingCartEditBo bo) {
+        for(Long id : bo.getIds()){
+            update(new LambdaUpdateWrapper<ShoppingCart>()
+                    .set(ShoppingCart::getChoiceStatus,bo.getChoiceStatus())
+                    .set(ShoppingCart::getUpdateTime,DateUtils.getNowTime())
+                    .eq(ShoppingCart::getId,id)
+                    .eq(ShoppingCart::getUserId,bo.getUserId()));
+        }
+        return true;
+    }
+
     private boolean checkUnique(ShoppingCart entity) {
         ShoppingCart info = getOne(new LambdaQueryWrapper<ShoppingCart>()
                 .eq(ShoppingCart::getUserId,entity.getUserId()).eq(ShoppingCart::getGoodsId,entity.getGoodsId()).last("limit 1"));

+ 73 - 8
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/UserProfileServiceImpl.java

@@ -33,6 +33,7 @@ import com.zhongzheng.modules.base.vo.UserProfileExportVo;
 import com.zhongzheng.modules.course.domain.CourseBusiness;
 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.inform.bo.InformUserAddBo;
 import com.zhongzheng.modules.inform.service.IInformRemindService;
 import com.zhongzheng.modules.inform.service.IInformUserService;
@@ -175,7 +176,14 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
         if(Validator.isEmpty(bo.getOrderGoodsId())||bo.getOrderGoodsId()==0L){
             throw new CustomException("参数错误");
         }
-
+        UserProfile old = getOne(new LambdaQueryWrapper<UserProfile>().eq(UserProfile::getOrderGoodsId, bo.getOrderGoodsId())
+                .eq(UserProfile::getCurrentStatus, 1L)
+                .eq(UserProfile::getChangeStatus, 1L)
+                .eq(UserProfile::getTypeStatus, bo.getTypeStatus())
+                .last("limit 1"));
+        if(Validator.isNotEmpty(old)){
+            throw new CustomException("存在未处理的数据,无法操作");
+        }
         UserProfile add = BeanUtil.toBean(bo, UserProfile.class);
         validEntityBeforeSave(add);
         add.setCreateTime(DateUtils.getNowTime());
@@ -493,13 +501,13 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
         String keyValue = bo.getKeyValue();
         if (Validator.isNotEmpty(keyValue)) {
             Map<String, String> maps = JSONObject.parseObject(keyValue, Map.class);
-            String recent_photos, idcard_face_photo, idcard_national_photo,work_unit,idcard,name,education,apply_post;
+            String recent_photos, idcard_face_photo, idcard_national_photo,work_unit,idcard,name,education,apply_post,telphone,sex,school,unit_contact,unit_tel,graduation_time,major;
             LambdaUpdateWrapper<User> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
             objectLambdaUpdateWrapper.eq(User::getUserId, bo.getUserId());
+            UserVo user = iUserService.queryById(bo.getUserId());
             if (maps.containsKey("idcard")) {
                 idcard = JSONObject.parseObject(String.valueOf(maps.get("idcard")), UserProfileFit.class).getValue();
                 if(Validator.isNotEmpty(idcard)){
-                    UserVo user = iUserService.queryById(bo.getUserId());
                     if(Validator.isNotEmpty(user)&&Validator.isEmpty(user.getIdCard())){ //身份证为空是覆盖
                         User user2 = iUserService.getOne(new LambdaQueryWrapper<User>()
                                 .eq(User::getIdCard, EncryptHandler.encrypt(idcard)).last("limit 1"));
@@ -507,15 +515,31 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
                             throw new CustomException("身份证号码已存在,创建失败");
                         }
                         objectLambdaUpdateWrapper.set(User::getIdCard, idcard);
-                        if (maps.containsKey("name")) {
-                            name = JSONObject.parseObject(String.valueOf(maps.get("name")), UserProfileFit.class).getValue();
-                            if(Validator.isNotEmpty(name)){
-                                objectLambdaUpdateWrapper.set(User::getRealname, name);
-                            }
+                    }
+                }
+            }
+            if (maps.containsKey("telphone")) {
+                telphone = JSONObject.parseObject(String.valueOf(maps.get("telphone")), UserProfileFit.class).getValue();
+                if(Validator.isNotEmpty(telphone)){
+                    if(Validator.isNotEmpty(user)&&Validator.isEmpty(user.getTelphone())){ //手机号码为空是覆盖
+                        User user2 = iUserService.getOne(new LambdaQueryWrapper<User>()
+                                .eq(User::getTelphone, EncryptHandler.encrypt(telphone)).last("limit 1"));
+                        if(Validator.isNotEmpty(user2)){
+                            throw new CustomException("手机号码已存在,创建失败");
                         }
+                        objectLambdaUpdateWrapper.set(User::getTelphone, telphone);
                     }
                 }
             }
+            if (maps.containsKey("name")) {
+                name = JSONObject.parseObject(String.valueOf(maps.get("name")), UserProfileFit.class).getValue();
+                if(Validator.isNotEmpty(name)){
+                    if(Validator.isNotEmpty(user)&&Validator.isEmpty(user.getRealname())) { //姓名为空是覆盖
+                        objectLambdaUpdateWrapper.set(User::getRealname, name);
+                    }
+
+                }
+            }
             if (maps.containsKey("recent_photos")) {
                 recent_photos = JSONObject.parseObject(String.valueOf(maps.get("recent_photos")), UserProfileFit.class).getValue();
                 if(Validator.isNotEmpty(recent_photos)){
@@ -552,6 +576,42 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
                     objectLambdaUpdateWrapper.set(User::getJob, apply_post);
                 }
             }
+            if (maps.containsKey("sex")) {
+                sex = JSONObject.parseObject(String.valueOf(maps.get("sex")), UserProfileFit.class).getValue();
+                if(Validator.isNotEmpty(sex)){
+                    objectLambdaUpdateWrapper.set(User::getSex, sex.equals("男")?1:2);
+                }
+            }
+            if (maps.containsKey("school")) {
+                school = JSONObject.parseObject(String.valueOf(maps.get("school")), UserProfileFit.class).getValue();
+                if(Validator.isNotEmpty(school)){
+                    objectLambdaUpdateWrapper.set(User::getSchool, school);
+                }
+            }
+            if (maps.containsKey("unit_contact")) {
+                unit_contact = JSONObject.parseObject(String.valueOf(maps.get("unit_contact")), UserProfileFit.class).getValue();
+                if(Validator.isNotEmpty(unit_contact)){
+                    objectLambdaUpdateWrapper.set(User::getUnitContact, unit_contact);
+                }
+            }
+            if (maps.containsKey("unit_tel")) {
+                unit_tel = JSONObject.parseObject(String.valueOf(maps.get("unit_tel")), UserProfileFit.class).getValue();
+                if(Validator.isNotEmpty(unit_tel)){
+                    objectLambdaUpdateWrapper.set(User::getUnitTel, unit_tel);
+                }
+            }
+            if (maps.containsKey("graduation_time")) {
+                graduation_time = JSONObject.parseObject(String.valueOf(maps.get("graduation_time")), UserProfileFit.class).getValue();
+                if(Validator.isNotEmpty(graduation_time)){
+                    objectLambdaUpdateWrapper.set(User::getGraduationTime, graduation_time);
+                }
+            }
+            if (maps.containsKey("major")) {
+                major = JSONObject.parseObject(String.valueOf(maps.get("major")), UserProfileFit.class).getValue();
+                if(Validator.isNotEmpty(major)){
+                    objectLambdaUpdateWrapper.set(User::getMajor, major);
+                }
+            }
             objectLambdaUpdateWrapper.set(User::getUpdateTime, DateUtils.getNowTime());
             iUserService.update(null, objectLambdaUpdateWrapper);
         }
@@ -967,6 +1027,11 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
         return baseMapper.getProfileStatusNum(bo);
     }
 
+    @Override
+    public UserProfile getByOrderGoodsIdNoTenant(Long orderGoodsId) {
+        return baseMapper.getByOrderGoodsIdNoTenant(orderGoodsId);
+    }
+
     /**
      * url读取image转换为Base64字符串
      *

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/vo/CertificatePhotoVo.java

@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 
@@ -24,6 +25,8 @@ public class CertificatePhotoVo {
 	private String realname;
 	@ApiModelProperty("身份证号")
 	private String idCard;
+	@ApiModelProperty("一寸照片")
+	private String oneInchPhotos;
 
 	@ApiModelProperty("年份")
 	private String year;
@@ -54,5 +57,8 @@ public class CertificatePhotoVo {
 	/** 培训结束时间 */
 	@ApiModelProperty("培训结束时间")
 	private Long trainEndTime;
+	@Excel(name = "公共学时")
+	@ApiModelProperty("公共学时")
+	private String publicClassHours;
 
 }

+ 8 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/vo/ShoppingCartVo.java

@@ -1,12 +1,13 @@
 package com.zhongzheng.modules.base.vo;
 
 import com.zhongzheng.common.annotation.Excel;
+import com.zhongzheng.modules.grade.vo.ClassGradeVo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.math.BigDecimal;
-
+import java.util.List;
 
 
 /**
@@ -65,4 +66,10 @@ public class ShoppingCartVo {
 	private String distributionCode;
 	@ApiModelProperty("活动状态是否已结束:1已结束,0未结束")
 	private Integer distributionStatus;
+	@ApiModelProperty("勾选状态 0无 1已勾选")
+	private Integer choiceStatus;
+	@ApiModelProperty("班级列表")
+	private List<ClassGradeVo> gradeList;
+	@ApiModelProperty("七大员继教可选年份")
+	private String sevenYear;
 }

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/vo/UserProfileVo.java

@@ -112,4 +112,10 @@ public class UserProfileVo {
 	private Integer typeStatus;
 	/** 订单商品ID */
 	private Long orderGoodsId;
+
+	@ApiModelProperty("报名时间")
+	private Long applyTime;
+
+	@ApiModelProperty("公司名称")
+	private String companyName;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/collect/mapper/CollectQuestionMapper.java

@@ -23,4 +23,6 @@ public interface CollectQuestionMapper extends BaseMapper<CollectQuestion> {
     List<QuestionVo> selectExamQuestionList(CollectQuestionQueryBo bo);
 
     List<CollectQuestionVo> selectTypeNum(CollectQuestionQueryBo bo);
+
+    List<CollectQuestionVo> selectSpecialExam(CollectQuestionQueryBo bo);
 }

+ 7 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/collect/service/impl/CollectQuestionServiceImpl.java

@@ -3,6 +3,7 @@ package com.zhongzheng.modules.collect.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.modules.bank.vo.QuestionVo;
@@ -67,13 +68,18 @@ public class CollectQuestionServiceImpl extends ServiceImpl<CollectQuestionMappe
                 .eq(CollectQuestion::getGoodsId,goodsId)
                 .last("limit 1"));
         if(Validator.isEmpty(info)){
-            throw new CustomException("没收藏数据");
+            return null;
+//            throw new CustomException("没收藏数据");
         }
         return info;
     }
 
     @Override
     public List<CollectQuestionVo> selectExamList(CollectQuestionQueryBo bo) {
+        if (ObjectUtils.isNotNull(bo.getDoMode()) && bo.getDoMode() == 4){
+            //山东题库
+            return collectQuestionMapper.selectSpecialExam(bo);
+        }
         return collectQuestionMapper.selectExamList(bo);
     }
 

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CheckSectionWatchVo.java

@@ -58,4 +58,10 @@ public class CheckSectionWatchVo implements Serializable {
 
     @ApiModelProperty("录播和回放的url地址")
     private String recordingUrl;
+
+    @ApiModelProperty("直播开始时间")
+    private Long liveStartTime;
+
+    @ApiModelProperty("直播结束时间")
+    private Long liveEndTime;
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseAddBo.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.course.bo;
 
+import com.zhongzheng.common.annotation.Excel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -78,5 +79,8 @@ public class CourseAddBo {
     /** 1显示 0隐藏 */
     @ApiModelProperty("1显示 0隐藏")
     private Integer courseShow;
+    /** 优选生成 0否 1是 */
+    @ApiModelProperty("优选生成 0否 1是")
+    private Integer firstChoice;
 
 }

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseBusinessQueryBo.java

@@ -60,7 +60,7 @@ public class CourseBusinessQueryBo extends BaseEntity {
 
 	/** 教育类型id */
 	@ApiModelProperty("教育类型id")
-	private Integer educationId;
+	private Long educationId;
 
 	@Excel(name = "模板选用")
 	@ApiModelProperty("模板选用")

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseChapterAddBo.java

@@ -53,4 +53,6 @@ public class CourseChapterAddBo {
     /** 导入编号 */
     @ApiModelProperty("导入编号")
     private String importNo;
+    @ApiModelProperty("公共标识:1公共章 0非公共章")
+    private Integer commonSign;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseChapterEditBo.java

@@ -64,4 +64,7 @@ public class CourseChapterEditBo {
     /** 导入编号 */
     @ApiModelProperty("导入编号")
     private String importNo;
+
+    @ApiModelProperty("公共标识:1公共章 0非公共章")
+    private Integer commonSign;
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseEditBo.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.course.bo;
 
+import com.zhongzheng.common.annotation.Excel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -96,4 +97,8 @@ public class CourseEditBo {
     /** 1显示 0隐藏 */
     @ApiModelProperty("1显示 0隐藏")
     private Integer courseShow;
+    /** 优选生成 0否 1是 */
+    @ApiModelProperty("优选生成 0否 1是")
+    private Integer firstChoice;
+
 }

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseHandoutsEditBo.java

@@ -62,6 +62,7 @@ public class CourseHandoutsEditBo {
 
     @ApiModelProperty("新增文件名称")
     private List<String> addFileNames;
+
     @ApiModelProperty("时间戳标识")
     private Long timeSign;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseMenuAddBo.java

@@ -42,4 +42,7 @@ public class CourseMenuAddBo {
     /** 排序 */
     @ApiModelProperty("排序")
     private Integer sort;
+    /** 是否优选  0没有 1选中 */
+    @ApiModelProperty("是否优选  0没有 1选中")
+    private Integer firstChoiceStatus;
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseMenuEditBo.java

@@ -48,4 +48,8 @@ public class CourseMenuEditBo {
     /** 排序 */
     @ApiModelProperty("排序")
     private Integer sort;
+
+    /** 是否优选  0没有 1选中 */
+    @ApiModelProperty("是否优选  0没有 1选中")
+    private Integer firstChoiceStatus;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseMenuQueryBo.java

@@ -79,4 +79,7 @@ public class CourseMenuQueryBo extends BaseEntity {
 
 	@ApiModelProperty("商品ID")
 	private Long goodsId;
+
+	@ApiModelProperty("是否获取学时 1获取")
+	private Integer getHours;
 }

+ 14 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseModuleAddBo.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.course.bo;
 
+import com.zhongzheng.common.annotation.Excel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -53,4 +54,17 @@ public class CourseModuleAddBo {
     /** 赠送卷ID */
     @ApiModelProperty("赠送卷ID")
     private Long freeExamId;
+
+    @ApiModelProperty("公共标识:1公共章 0非公共章")
+    private Integer commonSign;
+    /** 证书类型ID */
+    @ApiModelProperty("证书类型ID")
+    private Long certificateTypeId;
+    /** 证书ID */
+    @ApiModelProperty("证书ID")
+    private Long certificateId;
+    /** 证书模板ID */
+    @ApiModelProperty("证书模板ID")
+    private Long certificateTpId;
+
 }

+ 16 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseModuleEditBo.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.course.bo;
 
+import com.zhongzheng.common.annotation.Excel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -63,4 +64,19 @@ public class CourseModuleEditBo {
     @ApiModelProperty("赠送卷ID")
     private Long freeExamId;
 
+    /** 证书类型ID */
+    @Excel(name = "证书类型ID")
+    @ApiModelProperty("证书类型ID")
+    private Long certificateTypeId;
+    /** 证书ID */
+    @Excel(name = "证书ID")
+    @ApiModelProperty("证书ID")
+    private Long certificateId;
+    /** 证书模板ID */
+    @Excel(name = "证书模板ID")
+    @ApiModelProperty("证书模板ID")
+    private Long certificateTpId;
+    @ApiModelProperty("公共标识:1公共章 0非公共章")
+    private Integer commonSign;
+
 }

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CoursePhotoLogAddBo.java

@@ -66,4 +66,5 @@ public class CoursePhotoLogAddBo {
     /** 课程ID */
     @ApiModelProperty("课程ID")
     private Long courseId;
+    private Long orderGoodsId;
 }

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CoursePhotoLogQueryBo.java

@@ -62,4 +62,5 @@ public class CoursePhotoLogQueryBo extends BaseEntity {
 	/** 课程ID */
 	@ApiModelProperty("课程ID")
 	private Long courseId;
+	private Long orderGoodsId;
 }

+ 33 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseQueryBo.java

@@ -114,4 +114,37 @@ public class CourseQueryBo extends BaseEntity {
 
 	@ApiModelProperty("手机号码")
 	private List<CourseProgressQueryBo> telphoneList;
+
+	@ApiModelProperty("1未开始 2未完成 3已完成")
+	private Integer studyStatus;
+
+	/** 旧企业ID */
+	@ApiModelProperty("旧企业ID")
+	private String oldCompanyId;
+
+	/** 旧机构ID */
+	@ApiModelProperty("旧机构ID")
+	private String oldInstitutionId;
+
+	@ApiModelProperty("旧客户ID")
+	private String oldCustomerId;
+
+	/** 身份证号 */
+	@ApiModelProperty("身份证号")
+	private String idCard;
+
+	/** 真实姓名 */
+	@ApiModelProperty("真实姓名")
+	private String realname;
+
+	@ApiModelProperty("旧业务系统订单号")
+	private String oldOrderSn;
+
+	@ApiModelProperty("查询标识:1 PC学习列表")
+	private Integer querySign;
+
+	@ApiModelProperty("学习是否完成 1完成 2未学完")
+	private Integer studyFinishStatus;
+
+	private List<Long> orderGoodsIds;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/domain/Course.java

@@ -72,5 +72,8 @@ private static final long serialVersionUID=1L;
     private Long tenantId;
     @TableField(exist = false)
     private Long oId;
+    /** 优选生成 0否 1是 */
+    private Integer firstChoice;
+
 
 }

Vissa filer visades inte eftersom för många filer har ändrats