wzy 2 hafta önce
ebeveyn
işleme
25077b66ce

+ 6 - 0
mjava-zhongche/src/main/java/com/malk/zhongche/controller/ZhongcheController.java

@@ -21,6 +21,12 @@ public class ZhongcheController {
         return zhongcheService.getTaskInfo(taskId,projectId);
     }
 
+    //获取项目信息
+    @GetMapping("/getProjectInfo")
+    public McR getProjectInfo(String projectId){
+        return zhongcheService.getProjectInfo(projectId);
+    }
+
     //更新任务延期信息
     @PostMapping("/updateTaskDelayInfo")
     public McR updateTaskDelayInfo(@RequestBody Map map){

+ 3 - 0
mjava-zhongche/src/main/java/com/malk/zhongche/service/ZhongcheService.java

@@ -14,4 +14,7 @@ public interface ZhongcheService {
     void updateLastTaskSfc();
 
     McR finishTask(Map map);
+
+    McR getProjectInfo(String projectId);
+
 }

+ 28 - 0
mjava-zhongche/src/main/java/com/malk/zhongche/service/impl/ZhongcheServiceImpl.java

@@ -393,6 +393,34 @@ public class ZhongcheServiceImpl implements ZhongcheService {
         return McR.success();
     }
 
+    @Override
+    public McR getProjectInfo(String projectId) {
+        List<Map> results = tbClient.projectDetail(projectId, null, null);
+
+        Map result = (Map) results.get(0);
+
+        Map map = new HashMap();
+
+        List<Map> customfields = UtilMap.getList(result, "customfields");
+
+        for (Map customfield : customfields) {
+            String customfieldId = UtilMap.getString(customfield, "customfieldId");
+
+            //项目号
+            if ("6805ecf00763b2e708d760bc".equals(customfieldId)){
+                List<Map> values = UtilMap.getList(customfield, "value");
+
+                Map value = values.get(0);
+
+                String title = UtilMap.getString(value, "title");
+
+                map.put("projectNo",title);
+            }
+        }
+
+        return McR.success(map);
+    }
+
     /**
      * 上传文件(核心方法)
      * @param filePath 本地文件路径(如"2.png")