anderx 1 рік тому
батько
коміт
e543d55b7e

+ 5 - 5
ruoyi-admin/src/main/resources/application-druid-dev.yml

@@ -71,8 +71,8 @@ tianhe:
     prefix: yfdk_test
     appid: tichain024581
     appkey: 5bc9a2c89b808b7c545a71473710db6e79dcf519
-    add_user_url: https://api.tichain.tianhecloud.com/api/v2/user
-    seve_text_url: https://api.tichain.tianhecloud.com/v1/deposit/text/save
-    seve_file_url: https://api.tichain.tianhecloud.com/v1/deposit/file/save
-    deposit_certificate_url: https://api.tichain.tianhecloud.com/v1/deposit/certificate
-    deposit_query_url: https://api.tichain.tianhecloud.com/v1/deposit/query
+    add_user_url: https://test.api.tichain.tianhecloud.com/api/v2/user
+    seve_text_url: https://test.api.tichain.tianhecloud.com/v1/deposit/text/save
+    seve_file_url: https://test.api.tichain.tianhecloud.com/v1/deposit/file/save
+    deposit_certificate_url: https://test.api.tichain.tianhecloud.com/v1/deposit/certificate
+    deposit_query_url: https://test.api.tichain.tianhecloud.com/v1/deposit/query

+ 13 - 13
ruoyi-system/src/main/java/com/ruoyi/project/service/impl/ProjectTaskServiceImpl.java

@@ -384,7 +384,7 @@ public class ProjectTaskServiceImpl   implements ProjectTaskService {
                           ProjectStaffRecord projectStaffRecord) throws InterruptedException {
         String json = JSONObject.toJSONString(map);
         String address = getAddress();
-        String  operateId = DateUtils.dateTimeNow();
+        String  operateId = "yfdk_"+DateUtils.dateTimeNow();
         String s = tianheService.seveText(address, json, operateId);
         JSONObject res = JSONObject.parseObject(s);
         Integer code = (Integer) res.get("code");
@@ -393,8 +393,8 @@ public class ProjectTaskServiceImpl   implements ProjectTaskService {
             sleep(1000);
             String certificate = tianheService.getCertificate(address, operateId);
             JSONObject certificateData = JSONObject.parseObject(certificate);
-            String code2=res.getString("code");
-            if (code2.equals("200")){
+            Integer code2= (Integer) certificateData.get("code");
+            if (code2==HttpStatus.OK.value()){
                 log.debug(certificateData.toJSONString());
                 tianheCloudUrl=certificateData.getString("data");
                 if (projectTask!=null){
@@ -413,9 +413,14 @@ public class ProjectTaskServiceImpl   implements ProjectTaskService {
                     projectStaffRecordMapper.updateByPrimaryKeySelective(newPSR);
                 }
             }else {
-                log.error(res.getString("msg"));
+                String msg = certificateData.getString("msg");
+                log.error(msg);
+                throw new RuntimeException(msg);
             }
-
+        }else {
+            String msg = res.getString("msg");
+            log.error(msg);
+            throw new RuntimeException(msg);
         }
     }
 
@@ -438,9 +443,8 @@ public class ProjectTaskServiceImpl   implements ProjectTaskService {
     private String getAddress() {
         String address = null;
         SysUser user = SecurityUtils.getLoginUser().getUser();
-        if (user.getTianheId()==null){
-            SysUser sysUser = userMapper.selectUserById(user.getUserId());
-            if (sysUser.getTianheId()==null){
+        SysUser sysUser = userMapper.selectUserById(user.getUserId());
+        if (sysUser.getTianheId()==null){
                 try {
                     String userId=user.getUserId().toString();
                     String s = tianheService.addUser( userId, "123456");
@@ -456,12 +460,8 @@ public class ProjectTaskServiceImpl   implements ProjectTaskService {
                     user.setTianheId(address);
                     userMapper.updateUser(user);
                 }
-            }else {
-                address = sysUser.getTianheId();
-            }
         }else {
-
-            address = user.getTianheId();
+            address=sysUser.getTianheId();
         }
         if (address==null){
             throw new ServiceException("天河账号不存在,请稍后再试");

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/project/service/impl/TianheService.java

@@ -168,7 +168,7 @@ public class TianheService {
         // 请求路径,仅截取域名后及 Query 参数前部分,例:"/v1/deposit/query";
         String uri = "/v1/deposit/certificate";
         //接口签名
-        String signature = TianheSignUtil.signRequest(uri, query, body, timestamp, appkey);
+        String signature = TianheSignUtil.signRequest(uri,  query,body, timestamp, appkey);
         //hutool.http
         String result2 = HttpRequest.get(deposit_certificate_url + "?address="+address+"&operateId="+operateId)
                 .header("ti-appid", appid)