xuzhancheng 1 тиждень тому
батько
коміт
a13efe030e

+ 19 - 14
tz-module-pressure2/tz-module-pressure2-biz/src/main/java/cn/start/tz/module/pressure2/service/externalOA/ExternalOAServiceImpl.java

@@ -19,6 +19,7 @@ import cn.start.tz.module.system.api.user.AdminUserApi;
 import cn.start.tz.module.system.api.user.dto.AdminUserRespDTO;
 import com.alibaba.cloud.commons.lang.StringUtils;
 import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
 import jakarta.annotation.Resource;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
@@ -110,7 +111,7 @@ public class ExternalOAServiceImpl implements ExternalOAService {
         req.setTemplateCode("jianwureport");
         req.setDraft("0");
         log.info("发起OA流程参数:{}", JSON.toJSONString(req));
-        String result = HttpUtil.createPost(this.oaHost + "/seeyon/rest/myflow/sendflow?token=" + this.getExternalOAToken(oaLoginName).getId())
+        String result = HttpUtil.createPost(this.oaHost + "/seeyon/rest/myflow/sendflow?token=" + this.getExternalOAToken(oaLoginName).getBindingUser().getId())
                 .body(JSON.toJSONString(req))
                 .execute()
                 .body();
@@ -126,7 +127,7 @@ public class ExternalOAServiceImpl implements ExternalOAService {
      */
     @Override
     public ExternalOACommentRes getExternalOAComment(String summaryid) {
-        String url = this.oaHost + "/seeyon/rest/myflow/usercomment?token=" + this.getExternalOAToken(null).getId() + "&summaryId=" + summaryid;
+        String url = this.oaHost + "/seeyon/rest/myflow/usercomment?token=" + this.getExternalOAToken(null).getBindingUser().getId() + "&summaryId=" + summaryid;
         String result = HttpUtil.createGet(url)
                 .execute().body();
         log.info("获取OA流程状态结果:{}", result);
@@ -198,21 +199,25 @@ public class ExternalOAServiceImpl implements ExternalOAService {
     public CommonResult<Boolean> cancleflow(String summaryId) {
         log.info("撤销OA流程,summaryId={}", summaryId);
         // 调用OA系统撤销流程接口
-        String url = this.oaHost + "/seeyon/rest/myflow/cancleflow?token=" + this.getExternalOAToken(null).getId() + "&summaryId=" + summaryId;
-        String result = HttpUtil.createGet(url)
+        String url = this.oaHost + "/seeyon/rest/myflow/cancleflow?token=" + this.getExternalOAToken("300801").getBindingUser().getId();
+        JSONObject params = new JSONObject();
+        params.put("summaryId", summaryId);
+        String result = HttpUtil.createPost(url).body(params.toJSONString())
                 .execute().body();
         log.info("撤销OA流程结果:{}", result);
-
-        // 委派给业务服务处理:回退报告状态 + 增加流转记录
-        if (boilerTaskOrderItemReportService.handleOACancelFlow(summaryId)) {
-            return CommonResult.success(true);
-        }
-        if (pipeTaskOrderItemReportService.handleOACancelFlow(summaryId)) {
-            return CommonResult.success(true);
+        JSONObject jsonObject = JSON.parseObject(result);
+        if (jsonObject.getString("data") != null && jsonObject.getString("data").contains("撤销成功!")) {
+            // 委派给业务服务处理:回退报告状态 + 增加流转记录
+            if (boilerTaskOrderItemReportService.handleOACancelFlow(summaryId)) {
+                return CommonResult.success(true);
+            }
+            if (pipeTaskOrderItemReportService.handleOACancelFlow(summaryId)) {
+                return CommonResult.success(true);
+            }
         }
 
         log.warn("撤销OA流程:未找到summaryId={}对应的报告记录", summaryId);
-        return CommonResult.success(true);
+        return CommonResult.success(false);
     }
 
     @Override
@@ -257,7 +262,7 @@ public class ExternalOAServiceImpl implements ExternalOAService {
         }
 
         // 构建请求并调用OA获取待办事项列表
-        String url = this.oaHost + "/seeyon/rest/myflow/getAffairs?token=" + tokenRes.getId();
+        String url = this.oaHost + "/seeyon/rest/myflow/getAffairs?token=" + tokenRes.getBindingUser().getId();
         Map<String, String> requestBody = new HashMap<>();
         requestBody.put("memberCode", checkedData.getUsername());
         requestBody.put("templateCode", "jianwureport");
@@ -323,7 +328,7 @@ public class ExternalOAServiceImpl implements ExternalOAService {
         }
 
         // 构建请求并调用OA获取待办事项列表
-        String url = this.oaHost + "/seeyon/rest/myflow/getAffairs?token=" + tokenRes.getId();
+        String url = this.oaHost + "/seeyon/rest/myflow/getAffairs?token=" + tokenRes.getBindingUser().getId();
         Map<String, String> requestBody = new HashMap<>();
         requestBody.put("memberCode", checkedData.getUsername());
         requestBody.put("templateCode", "jianwureport");