|
@@ -29,6 +29,7 @@ import jakarta.annotation.Resource;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
import java.io.ByteArrayInputStream;
|
|
@@ -65,9 +66,11 @@ public class ExternalOAServiceImpl implements ExternalOAService {
|
|
|
private DynamicTbValService dynamicTbValService;
|
|
private DynamicTbValService dynamicTbValService;
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
|
|
+ @Lazy
|
|
|
private BoilerTaskOrderItemReportService boilerTaskOrderItemReportService;
|
|
private BoilerTaskOrderItemReportService boilerTaskOrderItemReportService;
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
|
|
+ @Lazy
|
|
|
private PipeTaskOrderItemReportService pipeTaskOrderItemReportService;
|
|
private PipeTaskOrderItemReportService pipeTaskOrderItemReportService;
|
|
|
|
|
|
|
|
@Value("${tz.fonts-folder-path:}")
|
|
@Value("${tz.fonts-folder-path:}")
|
|
@@ -239,4 +242,65 @@ public class ExternalOAServiceImpl implements ExternalOAService {
|
|
|
log.warn("OA退回流程:未找到summaryId={}对应的报告记录", summaryId);
|
|
log.warn("OA退回流程:未找到summaryId={}对应的报告记录", summaryId);
|
|
|
return CommonResult.error(500, "未找到对应的报告记录");
|
|
return CommonResult.error(500, "未找到对应的报告记录");
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String getAffairLink(String summaryId) {
|
|
|
|
|
+ log.info("获取OA待办事项链接,summaryId={}", summaryId);
|
|
|
|
|
+ // 获取OA系统token
|
|
|
|
|
+ ExternalOATokenRes tokenRes = this.getExternalOAToken(null);
|
|
|
|
|
+ if (tokenRes == null || StringUtils.isBlank(tokenRes.getId())) {
|
|
|
|
|
+ log.error("获取OA待办事项链接失败:获取token为空");
|
|
|
|
|
+ throw new RuntimeException("获取OA系统token失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 构建请求并调用OA获取待办事项列表
|
|
|
|
|
+ String url = this.oaHost + "/seeyon/rest/myflow/getAffairs?token=" + tokenRes.getId();
|
|
|
|
|
+ Map<String, String> requestBody = new HashMap<>();
|
|
|
|
|
+ requestBody.put("memberCode", "300801");
|
|
|
|
|
+ requestBody.put("templateCode", "jianwureport");
|
|
|
|
|
+ requestBody.put("pageNum", "1");
|
|
|
|
|
+ requestBody.put("pageSize", "999");
|
|
|
|
|
+
|
|
|
|
|
+ log.info("获取OA待办事项请求URL:{},参数:{}", url, JSON.toJSONString(requestBody));
|
|
|
|
|
+ try {
|
|
|
|
|
+ String result = HttpUtil.createPost(url)
|
|
|
|
|
+ .body(JSON.toJSONString(requestBody))
|
|
|
|
|
+ .timeout(30000)
|
|
|
|
|
+ .execute()
|
|
|
|
|
+ .body();
|
|
|
|
|
+ log.info("获取OA待办事项响应:{}", result);
|
|
|
|
|
+
|
|
|
|
|
+ // 解析响应并校验格式
|
|
|
|
|
+ OAGetAffairsResVO getAffairsRes = JSON.parseObject(result, OAGetAffairsResVO.class);
|
|
|
|
|
+ if (getAffairsRes == null) {
|
|
|
|
|
+ log.error("获取OA待办事项失败:响应解析为null");
|
|
|
|
|
+ throw new RuntimeException("OA接口响应数据格式异常");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (getAffairsRes.getCode() == null || getAffairsRes.getCode() != 0) {
|
|
|
|
|
+ log.error("获取OA待办事项失败:code={}, message={}", getAffairsRes.getCode(), getAffairsRes.getMessage());
|
|
|
|
|
+ throw new RuntimeException("OA接口返回异常:" + getAffairsRes.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ OAAffairDataVO data = getAffairsRes.getData();
|
|
|
|
|
+ if (data == null || data.getList() == null || data.getList().isEmpty()) {
|
|
|
|
|
+ log.warn("获取OA待办事项:summaryId={}未找到匹配的待办事项", summaryId);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 筛选SUMMARYID匹配的待办事项
|
|
|
|
|
+ long targetSummaryId = Long.parseLong(summaryId);
|
|
|
|
|
+ for (OAAffairItemVO item : data.getList()) {
|
|
|
|
|
+ if (item.getSummaryId() != null && item.getSummaryId() == targetSummaryId) {
|
|
|
|
|
+ log.info("获取OA待办事项链接成功:summaryId={}, link={}", summaryId, item.getLink());
|
|
|
|
|
+ return item.getLink() + "&token=" + tokenRes.getId();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ log.warn("获取OA待办事项:summaryId={}在返回列表中未找到匹配项", summaryId);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("获取OA待办事项链接异常,summaryId={}", summaryId, e);
|
|
|
|
|
+ throw new RuntimeException("获取OA待办事项链接失败:" + e.getMessage(), e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|