yangdamao 1 week ago
parent
commit
cf20bff683

+ 4 - 5
.drone.yml

@@ -15,18 +15,17 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
         path: /app/build # 将应用打包好的Jar和执行脚本挂载出来
     commands: # 定义在Docker容器中执行的shell命令
       - mvn clean package # 应用打包命令
-      - cp /drone/src/zhongzheng-api/target/zhongzheng-api.jar /app/build/zhongzheng-api.jar
-      - cp /drone/src/zhongzheng-admin/target/zhongzheng-admin.jar /app/build/zhongzheng-admin.jar
-      - cp /drone/src/zhongzheng-admin-saas/target/zhongzheng-admin-saas.jar /app/build/zhongzheng-admin-saas.jar
+      - cp /drone/src/zhongzheng-api/target/zhongzheng-question-api.jar /app/build/zhongzheng-question-api.jar
+      - cp /drone/src/zhongzheng-admin/target/zhongzheng-question-admin.jar /app/build/zhongzheng-question-admin.jar
       - cp Dockerfile /app/build/Dockerfile
       - cp Dockerfile-admi /app/build/Dockerfile-admi
-      - cp Dockerfile-saas /app/build/Dockerfile-saas
       - cp run-prod.sh /app/build/run-prod.sh
+    timeout: 2h  # 设置超时时间为 2 小时
 
   - name: build-start
     image: appleboy/drone-ssh:latest # SSH工具镜像
     settings:
-      host: 120.79.166.78 # 远程连接地址
+      host: 129.204.199.100 # 远程连接地址
       username: root # 远程连接账号
       key:
         from_secret: ssh_password

+ 4 - 4
Dockerfile

@@ -1,12 +1,12 @@
 # 该镜像需要依赖的基础镜像
 FROM openjdk:8
 # 将当前目录下的jar包复制到docker容器的/目录下
-ADD zhongzheng-api.jar /app.jar
+ADD zhongzheng-question-api.jar /question-app.jar
 # 声明服务运行在8080端口
-EXPOSE 5055
+EXPOSE 6066
 # 指定docker容器启动时运行jar包
-ENTRYPOINT ["java", "-jar","-Xms2048m", "-Xmx2048m","/app.jar"]
+ENTRYPOINT ["java", "-jar","-Xms2048m", "-Xmx2048m","/question-app.jar"]
 # 指定维护者的名字
-MAINTAINER zhongZheng
+MAINTAINER zhichen
 
 

+ 4 - 4
Dockerfile-admi

@@ -1,10 +1,10 @@
 # 该镜像需要依赖的基础镜像
 FROM openjdk:8
 # 将当前目录下的jar包复制到docker容器的/目录下
-ADD zhongzheng-admin.jar /app-admin.jar
+ADD zhongzheng-question-admin.jar /question-app-admin.jar
 # 声明服务运行在9099端口
-EXPOSE 5030
+EXPOSE 6050
 # 指定docker容器启动时运行jar包
-ENTRYPOINT ["java", "-jar","/app-admin.jar"]
+ENTRYPOINT ["java", "-jar","/question-app-admin.jar"]
 # 指定维护者的名字
-MAINTAINER zhongZheng
+MAINTAINER zhichen

+ 42 - 2
run-prod.sh

@@ -2,7 +2,7 @@
 # 定义应用组名
 group_name='zhongzheng'
 # 定义应用名称
-app_name='zhongzheng-saas-api'
+app_name='zhongzheng-question-api'
 # 定义应用版本
 app_version='1.0-SNAPSHOT'
 # 定义应用环境
@@ -17,7 +17,7 @@ echo '----rm image----'
 # 打包编译docker镜像
 docker build -f /mydata/maven/build/Dockerfile -t ${group_name}/${app_name}:${app_version} .
 echo '----build image----'
-docker run -p 5055:5055 --name ${app_name} \
+docker run -p 6066:6066 --name ${app_name} \
 --restart=always \
 -e 'spring.profiles.active'=${profile_active} \
 -e TZ="Asia/Shanghai" \
@@ -31,3 +31,43 @@ docker run -p 5055:5055 --name ${app_name} \
 -v /mydata/app/${app_name}/logs:/var/logs \
 -d ${group_name}/${app_name}:${app_version}
 echo '----start container----'
+
+echo "开始等待20秒..."
+# 1-10秒内随机
+sleep 5
+echo "等待后继续"
+
+#!/usr/bin/env bash
+# 定义应用组名
+group_admin_name='zhongzheng'
+# 定义应用名称
+app_admin_name='zhongzheng-question-admin'
+# 定义应用版本
+app_admin_version='1.0-SNAPSHOT'
+# 定义应用环境
+profile_active='prod'
+echo '----copy jar admin----'
+docker stop ${app_admin_name}
+echo '----stop container admin----'
+docker rm ${app_admin_name}
+echo '----rm container admin----'
+docker rmi ${group_admin_name}/${app_admin_name}:${app_admin_version}
+echo '----rm image admin----'
+# 打包编译docker镜像
+docker build -f /mydata/maven/build/Dockerfile-admi -t ${group_admin_name}/${app_admin_name}:${app_admin_version} .
+echo '----build image admin----'
+docker run \
+-p 6050:6050 \
+--name ${app_admin_name} \
+--restart=always \
+--log-opt max-size=50m \
+--log-opt max-file=3 \
+-e 'spring.profiles.active'=${profile_active} \
+-e TZ="Asia/Shanghai" \
+-v /etc/localtime:/etc/localtime \
+-v /usr/share/fonts:/usr/share/fonts \
+-v /data/logs/prod_admin:/logs \
+-v /mydata/app/${app_admin_name}/logs:/var/logs \
+-v /data/nginx/conf.d:/data/nginx/conf.d \
+-d ${group_admin_name}/${app_admin_name}:${app_admin_version}
+echo '----start container admin----'

+ 51 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/cos/CosController.java

@@ -0,0 +1,51 @@
+package com.zhongzheng.controller.cos;
+
+
+
+import com.zhongzheng.common.core.controller.BaseController;
+import com.zhongzheng.common.core.domain.AjaxResult;
+import com.zhongzheng.modules.txcos.bo.OssRequest;
+import com.zhongzheng.modules.txcos.service.CosService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 阿里OSS
+ *
+ * @author change
+ * @date 2021-05-17
+ */
+@Api(value = "腾讯COS上传文件控制器", tags = {"腾讯COS上传文件"})
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/tengxun/cos")
+public class CosController extends BaseController {
+
+    private static Logger log = LoggerFactory.getLogger(CosController.class);
+
+    private final CosService cosService;
+
+    /**
+     * upload上传文件
+     */
+    @ApiOperation("上传file图片")
+    @PostMapping("/upload")
+    public AjaxResult<String> upload(OssRequest file) throws Exception {
+        String result = cosService.upload(file);
+        return AjaxResult.success("返回图片路径",result);
+    }
+
+    @ApiOperation("上传file图片带路径")
+    @PostMapping("/uploadPath")
+    public AjaxResult<String> uploadPath(OssRequest file) throws Exception {
+        String result = cosService.uploadWithPath(file,file.getPath());
+        return AjaxResult.success("返回图片路径",result);
+    }
+}

+ 79 - 73
zhongzheng-admin/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://192.168.1.222:3306/zz_edu_question?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
+            url: jdbc:mysql://gz-cdb-4l867lmp.sql.tencentcdb.com:22924/zz_edu_question
             username: root
-            password: zhongzheng2021
+            password: Zckj2025!@#
             # 初始连接数
             initialSize: 5
             # 最小连接池数量
@@ -49,13 +49,13 @@ spring:
     # redis 配置
     redis:
         # 地址
-        host: 192.168.1.222
+        host: 129.204.199.100
         # 端口,默认为6379
         port: 6379
         # 数据库索引
         database: 0
         # 密码
-        password: zhongzheng2021_redis
+        password: zhichen@@2025
         # 连接超时时间
         timeout: 10s
         lettuce:
@@ -68,16 +68,24 @@ spring:
                 max-active: 8
                 # #连接池最大阻塞等待时间(使用负值表示没有限制)
                 max-wait: -1ms
+tengxun:
+    cos:
+        endpoint: https://file.gdzckj.net # oss对外服务的访问域名
+        accessKeyId: AKIDjJfIitpWyB9sMccPyJTQ82mHXZMtAD1Z  # 访问身份验证中用到用户标识
+        accessKeySecret: MTZQ1OXUDgtsc6KJ1e8ORGrGVXKtEfz5 # 用户用于加密签名字符串和oss用来验证签名字符串的密钥
+        bucketName: zhichen-prod-1346729515 # oss的存储空间
+        dir:
+            prefix: cos/images/ # 上传文件夹路径前缀 `
 aliyun:
     oss:
-        endpoint: https://file-dev.xyyxt.net # oss对外服务的访问域名
+        endpoint: https://file.xyyxt.net # oss对外服务的访问域名
         accessKeyId: LTAI5tDbpYmpifZYNX8S3kt1  # 访问身份验证中用到用户标识
         accessKeySecret: jCdSPAj58ZXOLsWpV8bCgNOYrEK0de # 用户用于加密签名字符串和oss用来验证签名字符串的密钥
-        bucketName: zhongzheng-test # oss的存储空间
+        bucketName: zhongzheng-prod # oss的存储空间
         policy:
             expire: 30 # 签名有效期(S)
         maxSize: 100 # 上传文件大小(M)
-        callback: http://120.79.166.78:19013/aliyun/oss/callback # 文件上传成功后的回调地址
+        callback: https://cloud.xyyxt.net/aliyun/oss/callback # 文件上传成功后的回调地址
         dir:
             prefix: oss/images/ # 上传文件夹路径前缀 `
 
@@ -106,52 +114,51 @@ 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: trial
+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
-    updateInvoicePath: http://gdxypx.xy.com/system/BussinessApi/UpdateInvoiceData
-    createExamPath: http://gdxypx.xy.com/system/BussinessApi/CreateSameClass
-    saveInvoice: http://gdxypx.xy.com/WitSystem/BussinessApi/InvoiceUpdate
+    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
+    saveInvoice: https://www.xyyxt.net/WitSystem/BussinessApi/InvoiceUpdate
 
 officialPush:
-    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
-
+    infoPath: https://jypt.gdcic.net/organjxjy/ShangBaoMingdan
+    periodPath: https://jypt.gdcic.net/organjxjy/XueshiShenqing
+    infoAccount: GDSXY
+    token: 01b5d9833987efdff54483cdc9720da6
+    sevenInfoPath: https://sgry.gdcic.net/organjxjy/ShangBaoMingdan
+    sevenPeriodPath: https://sgry.gdcic.net/organjxjy/XueshiShenqing
 
 distributionOldPay:
-    host: http://gdxypx.xy.com/System/BussinessApi/AddRedPackData
+    host: https://www.xyyxt.net/System/BussinessApi/AddRedPackData
 
 handouts:
-    savePath: http://192.168.1.7:9090/course/handouts/save
-    updatePath: http://192.168.1.7:9090/course/handouts/edit
+    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
@@ -159,56 +166,55 @@ Nuonuo:
     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
-    getResitTimes: http://gdxypx.xy.com/System/BussinessApi/GetResitTimes
-    classEndSaleTipMsg: http://gdxypx.xy.com/WitSystem/BussinessApi/ClassEndSaleTipMsg
-
+    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
+    getResitTimes: http://www.xyyxt.net/System/BussinessApi/GetResitTimes
+    classEndSaleTipMsg: http://www.xyyxt.net/WitSystem/BussinessApi/ClassEndSaleTipMsg
 oldSys:
-    host: http://gdxypx.xy.com
-    goods: http://gdxypx.xy.com/WitSystem/BussinessApi/NewYxtLogin
+    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
-    studyCheck: http://gdxypx.xy.com/System/BussinessApi/EjStudyCheck
+    studyCheck: http://www.xyyxt.net/System/BussinessApi/EjStudyCheck
 
 invoice:
-    host: http://192.168.1.222:7077/sys/common/openMplatform/log
+    host: https://ptapi.gdzzkj.net/sys/common/openMplatform/log
 
-liveHost: http://192.168.1.222:6009
+liveHost: https://sso.xyyxt.net
 
-fileHost: http://192.168.1.24:9099
+fileHost: http://39.108.7.155: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
-    subscribeAddExamResult: http://192.168.1.7:9099/cd/exam/add/exam/result
-    subscribeAddCertificate: http://192.168.1.7:9099/cd/exam/add/exam/result/certificate
+    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
+    subscribeAddExamResult: http://39.108.7.155:9099/cd/exam/add/exam/result
+    subscribeAddCertificate: http://39.108.7.155:9099/cd/exam/add/exam/result/certificate
     question: http://120.79.166.78:19013/common/question/getMeasureList
     questionDetail: http://120.79.166.78:19013/common/question/getTopicList
 
 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
+    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=
@@ -216,4 +222,4 @@ ZsBank:
     sm4key: VuAzSWQhsoNqzn0K
 
 record:
-    downloadPath: http://192.168.1.34:9090/common/user/data/download
+    downloadPath: http://39.108.7.155:9090/common/user/data/download

+ 12 - 4
zhongzheng-admin/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://rm-wz950fu2v70864v85.mysql.rds.aliyuncs.com/zz_edu_saas?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
+            url: jdbc:mysql://gz-cdb-4l867lmp.sql.tencentcdb.com:22924/zz_edu_question
             username: root
-            password: gdxy2021!@#zzjykj
+            password: Zckj2025!@#
             # 初始连接数
             initialSize: 5
             # 最小连接池数量
@@ -49,13 +49,13 @@ spring:
     # redis 配置
     redis:
         # 地址
-        host: 172.18.19.227
+        host: 129.204.199.100
         # 端口,默认为6379
         port: 6379
         # 数据库索引
         database: 0
         # 密码
-        password: zhongzheng@@2024
+        password: zhichen@@2025
         # 连接超时时间
         timeout: 10s
         lettuce:
@@ -68,6 +68,14 @@ spring:
                 max-active: 8
                 # #连接池最大阻塞等待时间(使用负值表示没有限制)
                 max-wait: -1ms
+tengxun:
+    cos:
+        endpoint: https://file.gdzckj.net # oss对外服务的访问域名
+        accessKeyId: AKIDjJfIitpWyB9sMccPyJTQ82mHXZMtAD1Z  # 访问身份验证中用到用户标识
+        accessKeySecret: MTZQ1OXUDgtsc6KJ1e8ORGrGVXKtEfz5 # 用户用于加密签名字符串和oss用来验证签名字符串的密钥
+        bucketName: zhichen-prod-1346729515 # oss的存储空间
+        dir:
+            prefix: cos/images/ # 上传文件夹路径前缀 `
 aliyun:
     oss:
         endpoint: https://file.xyyxt.net # oss对外服务的访问域名

+ 86 - 80
zhongzheng-api/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://192.168.1.222:3306/zz_edu_saas?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
+            url: jdbc:mysql://gz-cdb-4l867lmp.sql.tencentcdb.com:22924/zz_edu_question
             username: root
-            password: zhongzheng2021
+            password: Zckj2025!@#
             # 初始连接数
             initialSize: 5
             # 最小连接池数量
@@ -29,13 +29,13 @@ spring:
             webStatFilter:
                 enabled: true
             statViewServlet:
-                enabled: true
+                enabled: false
                 # 设置白名单,不填则允许所有访问
                 allow:
                 url-pattern: /druid/*
                 # 控制台管理用户名和密码
                 login-username: ruoyi
-                login-password: 123456
+                login-password: XYY@2025
             filter:
                 stat:
                     enabled: true
@@ -49,13 +49,13 @@ spring:
     # redis 配置
     redis:
         # 地址
-        host: 192.168.1.222
+        host: 129.204.199.100
         # 端口,默认为6379
         port: 6379
         # 数据库索引
         database: 0
         # 密码
-        password: zhongzheng2021_redis
+        password: zhichen@@2025
         # 连接超时时间
         timeout: 10s
         lettuce:
@@ -68,18 +68,27 @@ spring:
                 max-active: 8
                 # #连接池最大阻塞等待时间(使用负值表示没有限制)
                 max-wait: -1ms
+tengxun:
+    cos:
+        endpoint: https://file.gdzckj.net # oss对外服务的访问域名
+        accessKeyId: AKIDjJfIitpWyB9sMccPyJTQ82mHXZMtAD1Z  # 访问身份验证中用到用户标识
+        accessKeySecret: MTZQ1OXUDgtsc6KJ1e8ORGrGVXKtEfz5 # 用户用于加密签名字符串和oss用来验证签名字符串的密钥
+        bucketName: zhichen-prod-1346729515 # oss的存储空间
+        dir:
+            prefix: cos/images/ # 上传文件夹路径前缀 `
 aliyun:
     oss:
-        endpoint: https://file-dev.xyyxt.net # oss对外服务的访问域名
+        endpoint: https://file.xyyxt.net # oss对外服务的访问域名
         accessKeyId: LTAI5tDbpYmpifZYNX8S3kt1  # 访问身份验证中用到用户标识
         accessKeySecret: jCdSPAj58ZXOLsWpV8bCgNOYrEK0de # 用户用于加密签名字符串和oss用来验证签名字符串的密钥
-        bucketName: zhongzheng-test # oss的存储空间
+        bucketName: zhongzheng-prod # oss的存储空间
         policy:
             expire: 30 # 签名有效期(S)
         maxSize: 100 # 上传文件大小(M)
-        callback: http://120.79.166.78:19012/aliyun/oss/callback # 文件上传成功后的回调地址
+        callback: https://api.xyyxt.net/aliyun/oss/callback # 文件上传成功后的回调地址
         dir:
             prefix: oss/images/ # 上传文件夹路径前缀 `
+
 poliv:
     token:
         userid: d5f6d309fe
@@ -87,7 +96,6 @@ poliv:
         readtoken: f2c397b4-e2a3-46dc-9266-e6a43ac26a35
         secretkey: xpPrYdcbA1
 
-
 wx:
     small:
         appid: wxd3c8ae80cf43a305
@@ -106,110 +114,108 @@ 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: JhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsic2hhbmp1LXJlc291cmNlIl0sI
+    host: http://bg.sam457.site:9020
 
 certificate:
-    host: http://192.168.1.38:8000/
+    host: https://m.xyyxt.net/
 
+liveGotoURL: https://
 
-
-liveGotoURL: http://
-
-
-enCodeVersion: trial
+enCodeVersion: release
 
 oldStudySys:
-    syncPath: http://gdxypx.xy.com/System/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
-    updateInvoicePath: http://gdxypx.xy.com/system/BussinessApi/UpdateInvoiceData
-    createExamPath: http://gdxypx.xy.com/system/BussinessApi/CreateSameClass
-    saveInvoice: http://gdxypx.xy.com/WitSystem/BussinessApi/InvoiceUpdate
+    syncPath: https://www.xyyxt.net/System/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
+    saveInvoice: https://www.xyyxt.net/WitSystem/BussinessApi/InvoiceUpdate
 
 officialPush:
-    infoPath: https://jypt-dev.gdcic.net/organjxjy/ShangBaoMingdan
-    periodPath: https://jypt-dev.gdcic.net/organjxjy/XueshiShenqing
-    infoAccount: peixunjigou
-    token: 0ca175b9c0f726a831d895e26933246
-    sevenInfoPath: http://sgry.gdcic.net/organjxjy/ShangBaoMingdan
-    sevenPeriodPath: http://sgry.gdcic.net/organjxjy/XueshiShenqing
+    infoPath: https://jypt.gdcic.net/organjxjy/ShangBaoMingdan
+    periodPath: https://jypt.gdcic.net/organjxjy/XueshiShenqing
+    infoAccount: GDSXY
+    token: 01b5d9833987efdff54483cdc9720da6
+    sevenInfoPath: https://sgry.gdcic.net/organjxjy/ShangBaoMingdan
+    sevenPeriodPath: https://sgry.gdcic.net/organjxjy/XueshiShenqing
 
 distributionOldPay:
-    host: http://gdxypx.xy.com/System/BussinessApi/AddRedPackData
+    host: https://www.xyyxt.net/System/BussinessApi/AddRedPackData
 
 handouts:
-    savePath: http://192.168.1.7:9090/course/handouts/save
-    updatePath: http://192.168.1.7:9090/course/handouts/edit
+    savePath: https://attach.xyyxt.net/course/handouts/save
+    updatePath: https://attach.xyyxt.net/course/handouts/edit
 
 Nuonuo:
-    host: https://sandbox.nuonuocs.cn/open/v1/services
-    APPkey: SD39149760
-    APPSecret: SD168A248B2844E0
+    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
-    getResitTimes: http://gdxypx.xy.com/System/BussinessApi/GetResitTimes
-    classEndSaleTipMsg: http://gdxypx.xy.com/WitSystem/BussinessApi/ClassEndSaleTipMsg
+    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
+    getResitTimes: http://www.xyyxt.net/System/BussinessApi/GetResitTimes
+    classEndSaleTipMsg: http://www.xyyxt.net/WitSystem/BussinessApi/ClassEndSaleTipMsg
 oldSys:
-    host: http://gdxypx.xy.com
-    goods: http://gdxypx.xy.com/System/BussinessApi/NewYxtLogin
+    host: http://test.jqbao.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
-    studyCheck: http://gdxypx.xy.com/System/BussinessApi/EjStudyCheck
+    studyCheck: http://www.xyyxt.net/System/BussinessApi/EjStudyCheck
 
 invoice:
-    host: http://192.168.1.222:7077/sys/common/openMplatform/log
+    host: https://ptapi.gdzzkj.net/sys/common/openMplatform/log
+
+liveHost: https://sso.xyyxt.net
 
-liveHost: http://192.168.1.222:6009
+fileHost: http://39.108.7.155:9099
 
-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
-    subscribeAddExamResult: http://192.168.1.7:9099/cd/exam/add/exam/result
-    subscribeAddCertificate: http://192.168.1.7:9099/cd/exam/add/exam/result/certificate
+    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
+    subscribeAddExamResult: http://39.108.7.155:9099/cd/exam/add/exam/result
+    subscribeAddCertificate: http://39.108.7.155:9099/cd/exam/add/exam/result/certificate
     question: http://120.79.166.78:19013/common/question/getMeasureList
     questionDetail: http://120.79.166.78:19013/common/question/getTopicList
 
 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
+    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=
@@ -217,4 +223,4 @@ ZsBank:
     sm4key: VuAzSWQhsoNqzn0K
 
 record:
-    downloadPath: http://192.168.1.7:9090/common/user/data/download
+    downloadPath: http://39.108.7.155:9090/common/user/data/download

+ 12 - 16
zhongzheng-api/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://rm-wz950fu2v70864v85.mysql.rds.aliyuncs.com/zz_edu_saas?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
+            url: jdbc:mysql://gz-cdb-4l867lmp.sql.tencentcdb.com:22924/zz_edu_question
             username: root
-            password: gdxy2021!@#zzjykj
+            password: Zckj2025!@#
             # 初始连接数
             initialSize: 5
             # 最小连接池数量
@@ -49,13 +49,13 @@ spring:
     # redis 配置
     redis:
         # 地址
-        host: 172.18.19.227
+        host: 129.204.199.100
         # 端口,默认为6379
         port: 6379
         # 数据库索引
         database: 0
         # 密码
-        password: zhongzheng@@2024
+        password: zhichen@@2025
         # 连接超时时间
         timeout: 10s
         lettuce:
@@ -68,18 +68,14 @@ spring:
                 max-active: 8
                 # #连接池最大阻塞等待时间(使用负值表示没有限制)
                 max-wait: -1ms
-#aliyun:
-#    oss:
-#        endpoint: https://file.xyyxt.net # oss对外服务的访问域名
-#        accessKeyId: LTAI5tDbpYmpifZYNX8S3kt1  # 访问身份验证中用到用户标识
-#        accessKeySecret: jCdSPAj58ZXOLsWpV8bCgNOYrEK0de # 用户用于加密签名字符串和oss用来验证签名字符串的密钥
-#        bucketName: zhongzheng-prod # oss的存储空间
-#        policy:
-#            expire: 30 # 签名有效期(S)
-#        maxSize: 100 # 上传文件大小(M)
-#        callback: https://cloud.xyyxt.net/aliyun/oss/callback # 文件上传成功后的回调地址
-#        dir:
-#            prefix: oss/images/ # 上传文件夹路径前缀 `
+tengxun:
+    cos:
+        endpoint: https://file.gdzckj.net # oss对外服务的访问域名
+        accessKeyId: AKIDjJfIitpWyB9sMccPyJTQ82mHXZMtAD1Z  # 访问身份验证中用到用户标识
+        accessKeySecret: MTZQ1OXUDgtsc6KJ1e8ORGrGVXKtEfz5 # 用户用于加密签名字符串和oss用来验证签名字符串的密钥
+        bucketName: zhichen-prod-1346729515 # oss的存储空间
+        dir:
+            prefix: cos/images/ # 上传文件夹路径前缀 `
 aliyun:
     oss:
         endpoint: https://file.xyyxt.net # oss对外服务的访问域名

+ 7 - 0
zhongzheng-common/pom.xml

@@ -186,6 +186,13 @@
             <artifactId>javax.servlet-api</artifactId>
         </dependency>
 
+        <!-- COS 相关依赖 -->
+        <dependency>
+            <groupId>com.qcloud</groupId>
+            <artifactId>cos_api</artifactId>
+            <version>5.6.54</version>
+        </dependency>
+
         <!-- 腾讯云 -->
         <dependency>
             <groupId>com.tencentcloudapi</groupId>

+ 37 - 0
zhongzheng-framework/src/main/java/com/zhongzheng/framework/config/CosConfig.java

@@ -0,0 +1,37 @@
+package com.zhongzheng.framework.config;
+
+import com.qcloud.cos.COSClient;
+import com.qcloud.cos.ClientConfig;
+import com.qcloud.cos.auth.BasicCOSCredentials;
+import com.qcloud.cos.auth.COSCredentials;
+import com.qcloud.cos.region.Region;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class CosConfig {
+    @Value("${tengxun.cos.endpoint}")
+    private String ALIYUN_OSS_ENDPOINT;
+    @Value("${tengxun.cos.accessKeyId}")
+    private String ALIYUN_OSS_ACCESSKEYID;
+    @Value("${tengxun.cos.accessKeySecret}")
+    private String ALIYUN_OSS_ACCESSKEYSECRET;
+
+    @Bean
+    public COSClient cosClient(){
+        // 1. 初始化用户身份信息(secretId, secretKey)
+        String secretId = ALIYUN_OSS_ACCESSKEYID;
+        String secretKey = ALIYUN_OSS_ACCESSKEYSECRET;
+        COSCredentials cred = new BasicCOSCredentials(secretId, secretKey);
+
+        // 2. 设置bucket的区域, COS地域的简称请参照 https://cloud.tencent.com/document/product/436/6224
+        Region region = new Region("ap-guangzhou"); // 例如:北京区域
+
+        // 3. 生成cos客户端
+        ClientConfig clientConfig = new ClientConfig(region);
+        COSClient cosClient = new COSClient(cred, clientConfig);
+
+        return cosClient;
+    }
+}

+ 30 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/txcos/bo/FileHandleBo.java

@@ -0,0 +1,30 @@
+package com.zhongzheng.modules.txcos.bo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author yangdamao
+ * @date 2023年04月17日 9:33
+ */
+@Data
+public class FileHandleBo implements Serializable {
+
+    @ApiModelProperty("总片数")
+    private Integer shardCount;
+
+    @ApiModelProperty("序号")
+    private Integer index;
+
+    @ApiModelProperty("文件名称")
+    private String name;
+
+    @ApiModelProperty("文件标识")
+    private String fileSign;
+
+    @ApiModelProperty("完整文件的MD5值")
+    private String fileMd5;
+
+}

+ 25 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/txcos/bo/OssCallbackParam.java

@@ -0,0 +1,25 @@
+package com.zhongzheng.modules.txcos.bo;
+
+import lombok.Data;
+
+/**
+ * oss上传成功后的回调参数
+ */
+@Data
+public class OssCallbackParam {
+    /**
+     *
+        请求的回调地址
+     */
+    private String callbackUrl;
+    /**
+     *
+        回调是传入request中的参数
+     */
+    private String callbackBody;
+    /**
+        回调时传入参数的格式,比如表单提交形式
+    */
+    private String callbackBodyType;
+
+}

+ 35 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/txcos/bo/OssRequest.java

@@ -0,0 +1,35 @@
+package com.zhongzheng.modules.txcos.bo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author change
+ * @date 2021年06月10日 9:07
+ */
+@Data
+@ApiModel("传图片标识")
+public class OssRequest{
+
+    /** 上传图片标识 */
+    @ApiModelProperty(value = "上传图片标识 0头像 1身份证 2题库 3指南指引图片 4广告图片 5身份证或学信网图片 6文件excel,word,zip等 10文件zip",required = true)
+    @NotNull(message = "上传图片标识不能为空")
+    private Integer ImageStatus;
+
+    /** 上传图片 */
+    @ApiModelProperty("MultipartFile上传文件")
+    private MultipartFile file;
+
+    @ApiModelProperty("用户ID")
+    private Long userId;
+
+    @ApiModelProperty("班级ID")
+    private Long gradeId;
+
+    @ApiModelProperty("图片路径")
+    private String path;
+}

+ 18 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/txcos/service/CosService.java

@@ -0,0 +1,18 @@
+package com.zhongzheng.modules.txcos.service;
+
+
+
+
+
+import com.zhongzheng.modules.txcos.bo.OssRequest;
+
+import java.io.InputStream;
+
+public interface CosService {
+
+    String upload(OssRequest file) throws Exception;
+
+    String uploadInputStream(InputStream inputStream, Integer imageStatus)throws Exception;
+
+    String uploadWithPath(OssRequest file, String path)throws Exception;
+}

+ 198 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/txcos/service/impl/CosServiceImpl.java

@@ -0,0 +1,198 @@
+package com.zhongzheng.modules.txcos.service.impl;
+
+import cn.hutool.core.lang.Validator;
+import com.qcloud.cos.COSClient;
+import com.qcloud.cos.ClientConfig;
+import com.qcloud.cos.auth.BasicCOSCredentials;
+import com.qcloud.cos.auth.COSCredentials;
+import com.qcloud.cos.model.ObjectMetadata;
+import com.qcloud.cos.model.PutObjectRequest;
+import com.qcloud.cos.region.Region;
+import com.zhongzheng.modules.txcos.bo.OssRequest;
+import com.zhongzheng.modules.txcos.service.CosService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Random;
+
+@Service
+public class CosServiceImpl implements CosService {
+    private static final Logger LOGGER = LoggerFactory.getLogger(CosServiceImpl.class);
+
+    @Value("${tengxun.cos.dir.prefix}")
+    private String TENGXUN_COS_DIR_PREFIX;
+
+    @Value("${tengxun.cos.bucketName}")
+    private String TENGXUN_COS_BUCKET_NAME;
+
+    @Value("${tengxun.cos.accessKeyId}")
+    private String TENGXUN_COS_ACCESSKEYID;
+    @Value("${tengxun.cos.accessKeySecret}")
+    private String TENGXUN_COS_ACCESSKEYSECRET;
+
+
+    @Override
+    public String upload(OssRequest file) throws Exception{
+        // 初始化COS客户端
+        COSClient cosClient = initCOSClient();
+        //获取上传文件输入流
+        InputStream inputStream = file.getFile().getInputStream();
+        String originalFilename = file.getFile().getOriginalFilename();
+        String suffix = originalFilename.substring(originalFilename.lastIndexOf(".") + 1);
+
+        String fileName = TENGXUN_COS_DIR_PREFIX + generateRandomFilename(file) + "." + suffix;
+
+        // 指定要上传的文件
+        String bucketName = TENGXUN_COS_BUCKET_NAME;
+        String key =fileName; // 对象键,即上传到COS后的文件路径
+        ObjectMetadata metadata = new ObjectMetadata();
+        metadata.setContentType("image/jpeg"); // 设置 Content-Type
+        // 上传文件
+        PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, key, inputStream,metadata);
+        cosClient.putObject(putObjectRequest);
+
+        // 关闭客户端
+        cosClient.shutdown();
+        return key;
+    }
+
+    @Override
+    public String uploadInputStream(InputStream inputStream, Integer imageStatus) throws Exception{
+        // 初始化COS客户端
+        COSClient cosClient = initCOSClient();
+        OssRequest ossRequest = new OssRequest();
+        ossRequest.setImageStatus(imageStatus);
+
+        String fileName = TENGXUN_COS_DIR_PREFIX + generateRandomFilename(ossRequest);
+
+        // 指定要上传的文件
+        String bucketName = TENGXUN_COS_BUCKET_NAME;
+        String key =fileName; // 对象键,即上传到COS后的文件路径
+        ObjectMetadata metadata = new ObjectMetadata();
+        metadata.setContentType("image/jpeg"); // 设置 Content-Type
+        // 上传文件
+        PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, key, inputStream,metadata);
+        cosClient.putObject(putObjectRequest);
+
+        // 关闭客户端
+        cosClient.shutdown();
+        return key;
+    }
+
+    @Override
+    public String uploadWithPath(OssRequest file, String path)throws Exception {
+        // 初始化COS客户端
+        COSClient cosClient = initCOSClient();
+        //获取上传文件输入流
+        InputStream inputStream = file.getFile().getInputStream();
+
+        // 指定要上传的文件
+        String bucketName = TENGXUN_COS_BUCKET_NAME;
+        String key =path; // 对象键,即上传到COS后的文件路径
+        ObjectMetadata metadata = new ObjectMetadata();
+        metadata.setContentType("image/jpeg"); // 设置 Content-Type
+        // 上传文件
+        PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, key, inputStream,metadata);
+        cosClient.putObject(putObjectRequest);
+
+        // 关闭客户端
+        cosClient.shutdown();
+        return key;
+    }
+
+    private COSClient initCOSClient() {
+        // 1. 初始化用户身份信息(secretId, secretKey)
+        String secretId = TENGXUN_COS_ACCESSKEYID;
+        String secretKey = TENGXUN_COS_ACCESSKEYSECRET;
+        COSCredentials cred = new BasicCOSCredentials(secretId, secretKey);
+
+        // 2. 设置bucket的区域, COS地域的简称请参照 https://cloud.tencent.com/document/product/436/6224
+        Region region = new Region("ap-guangzhou"); // 例如:北京区域
+
+        // 3. 生成cos客户端
+        ClientConfig clientConfig = new ClientConfig(region);
+        COSClient cosClient = new COSClient(cred, clientConfig);
+
+        return cosClient;
+    }
+
+    //生成存储文件名
+    public String generateRandomFilename(OssRequest ossRequest) {
+        String prefixName = "";
+        if (Validator.isNotEmpty(ossRequest.getUserId()) && ossRequest.getUserId().longValue() > 0) {
+            prefixName = prefixName + ossRequest.getUserId();
+        }
+        if (Validator.isNotEmpty(ossRequest.getGradeId()) && ossRequest.getGradeId().longValue() > 0) {
+            prefixName = prefixName + "/" + ossRequest.getGradeId();
+        }
+        String RandomFilename = "";
+        //生成随机数
+        Random rand = new Random();
+        int random = rand.nextInt();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+        Calendar calCurrent = Calendar.getInstance();
+        int intDay = calCurrent.get(Calendar.DATE);
+        int intMonth = calCurrent.get(Calendar.MONTH) + 1;
+        int intYear = calCurrent.get(Calendar.YEAR);
+        String now = String.valueOf(System.currentTimeMillis());
+
+        RandomFilename = now + String.valueOf(random > 0 ? random : (-1) * random);
+        switch (ossRequest.getImageStatus()) {
+            case 0:
+                RandomFilename = "avatar" + "/" + prefixName + (Validator.isNotEmpty(prefixName) ? "" : (sdf.format(new Date()))) + "/" + now;
+                break;
+            case 1:
+                RandomFilename = "IDNumber" + "/" + prefixName + (Validator.isNotEmpty(prefixName) ? "" : (sdf.format(new Date()))) + "/" + now;
+                break;
+            case 2:
+                RandomFilename = "QuestionBank" + "/" + prefixName + (Validator.isNotEmpty(prefixName) ? "" : (sdf.format(new Date()))) + "/" + now;
+                break;
+            case 3:
+                RandomFilename = "guide" + "/" + prefixName + (Validator.isNotEmpty(prefixName) ? "" : (sdf.format(new Date()))) + "/" + now;
+                break;
+            case 4:
+                RandomFilename = "advertising" + "/" + prefixName + (Validator.isNotEmpty(prefixName) ? "" : (sdf.format(new Date()))) + "/" + now;
+                break;
+            case 5:
+                RandomFilename = "IDCard" + "/" + prefixName + (Validator.isNotEmpty(prefixName) ? "" : (sdf.format(new Date()))) + "/" + now;
+                break;
+            case 6:
+                RandomFilename = "file" + "/" + prefixName + (Validator.isNotEmpty(prefixName) ? "" : (sdf.format(new Date()))) + "/" + now;
+                break;
+            case 7:
+                RandomFilename = "certificate" + "/" + prefixName + (Validator.isNotEmpty(prefixName) ? "" : (sdf.format(new Date()))) + "/" + now;
+                break;
+            case 8:
+                RandomFilename = "question" + "/" + prefixName + (Validator.isNotEmpty(prefixName) ? "" : (sdf.format(new Date()))) + "/" + now+"img";
+                break;
+            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;
+            case 12:
+                String filename = ossRequest.getFile().getOriginalFilename();
+                RandomFilename = "file/dangan/upload/"+ filename.substring(0, filename.lastIndexOf("."));
+                break;
+            case 13:
+                String filename2 = ossRequest.getFile().getOriginalFilename();
+                RandomFilename = "tupain/"+ filename2.substring(0, filename2.lastIndexOf("."));
+                break;
+            case 14:
+                RandomFilename = "tupain/"+ now;
+                break;
+        }
+
+        return RandomFilename;
+    }
+}

+ 14 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/txcos/vo/FileBean.java

@@ -0,0 +1,14 @@
+package com.zhongzheng.modules.txcos.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+@Data
+@ApiModel("【oss】视图对象")
+public class FileBean {
+
+    private String path;
+
+    private String fileName;
+
+}

+ 21 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/txcos/vo/ResultBean.java

@@ -0,0 +1,21 @@
+package com.zhongzheng.modules.txcos.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+@Data
+@ApiModel("【oss】视图对象")
+public class ResultBean {
+
+
+    private Object resultContent;
+
+
+
+    public ResultBean(Object resultContent){
+        this.resultContent = resultContent;
+    }
+
+
+
+}