|
@@ -18,6 +18,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.google.common.base.Strings;
|
|
|
+import com.malk.core.McProject;
|
|
|
import com.malk.server.aliwork.YDConf;
|
|
|
import com.malk.server.aliwork.YDParam;
|
|
|
import com.malk.server.common.McR;
|
|
@@ -31,7 +32,9 @@ import com.malk.utils.UtilHttp;
|
|
|
import com.malk.utils.UtilMap;
|
|
|
import com.malk.utils.UtilToken;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringEscapeUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.commons.lang3.time.DateUtils;
|
|
|
import org.apache.http.HttpEntity;
|
|
|
import org.apache.http.client.HttpClient;
|
|
|
import org.apache.http.client.methods.HttpPost;
|
|
@@ -47,6 +50,7 @@ import java.io.*;
|
|
|
import java.net.HttpURLConnection;
|
|
|
import java.net.URL;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.ConcurrentHashMap;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@@ -67,6 +71,9 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
@Autowired
|
|
|
private YDService ydService;
|
|
|
|
|
|
+ @Value(value = "${teambition.TemplateId}")
|
|
|
+ private String templateId;
|
|
|
+
|
|
|
@Value(value = "${erp.url}")
|
|
|
private String erpUrl;
|
|
|
|
|
@@ -396,10 +403,16 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
case "紧急": body.put("priority", "D2_URGENT"); break;
|
|
|
case "特紧急": body.put("priority", "D3_VERY_URGENT"); break;
|
|
|
}
|
|
|
- String soType = getString(formData.get("selectField_lx2xj36n"));//订单类型
|
|
|
+ String soType = getString(formData.get("selectField_lx2xj36n"));//合同类型
|
|
|
switch (soType) {
|
|
|
- case "销售订单": body.put("soType", "D1_SALES_ORDER"); break;
|
|
|
+ case "常规订单":
|
|
|
+ case "特殊订单":
|
|
|
+ case "定制协议":
|
|
|
+ case "采购框架":
|
|
|
+ case "质量协议":
|
|
|
+ case "战略合作协议": body.put("soType", "D1_SALES_ORDER"); break;
|
|
|
case "预测订单": body.put("soType", "D2_FORECAST_ORDER"); break;
|
|
|
+ default: body.put("soType", "D1_SALES_ORDER"); break;
|
|
|
}
|
|
|
body.put("deliveryDate",getString(formData.get("textField_m0aduyx1")));//希望交期
|
|
|
body.put("salesperson",getString(formData.get("textField_m0aduyx9")));//销售员
|
|
@@ -537,10 +550,16 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
case "紧急": body.put("priority", "D2_URGENT"); break;
|
|
|
case "特紧急": body.put("priority", "D3_VERY_URGENT"); break;
|
|
|
}
|
|
|
- String soType = getString(formData.get("selectField_lx2xj36n"));//订单类型
|
|
|
+ String soType = getString(formData.get("selectField_lx2xj36n"));//合同类型
|
|
|
switch (soType) {
|
|
|
- case "销售订单": body.put("soType", "D1_SALES_ORDER"); break;
|
|
|
+ case "常规订单":
|
|
|
+ case "特殊订单":
|
|
|
+ case "定制协议":
|
|
|
+ case "采购框架":
|
|
|
+ case "质量协议":
|
|
|
+ case "战略合作协议": body.put("soType", "D1_SALES_ORDER"); break;
|
|
|
case "预测订单": body.put("soType", "D2_FORECAST_ORDER"); break;
|
|
|
+ default: body.put("soType", "D1_SALES_ORDER"); break;
|
|
|
}
|
|
|
body.put("deliveryDate",getString(formData.get("textField_m0aduyx1")));//希望交期
|
|
|
body.put("salesperson",getString(formData.get("textField_m0aduyx9")));//销售员
|
|
@@ -862,19 +881,237 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public McR getTbStageDetails(String projectName,String stageName) {
|
|
|
- Map<String,Object> stageDetail = new HashMap<>();
|
|
|
- //根据项目名称获取项目id
|
|
|
+ public McR updateCustomerProcess(Map map) {
|
|
|
+ if (Objects.isNull(map.get("formInstId"))){
|
|
|
+ return McR.errorParam("formInstId不能为空");
|
|
|
+ }
|
|
|
+ String formInstId = map.get("formInstId").toString();
|
|
|
+
|
|
|
+ DDR_New ddrNew = ydClient.queryData(YDParam.builder().formInstId(formInstId).build(), YDConf.FORM_QUERY.retrieve_id);
|
|
|
+ Map formData = ddrNew.getFormData();
|
|
|
+
|
|
|
+ //修改客户的类型
|
|
|
+ String customerType = formData.get("selectField_lzmh4hf8").toString();
|
|
|
+ String updateFormInstId = "";
|
|
|
+ if (customerType.equals("意向客户")){
|
|
|
+ //意向客户
|
|
|
+ String jsonString = formData.get("associationFormField_lzto0clw_id").toString();
|
|
|
+ String customerJsonString = StringEscapeUtils.unescapeJava(jsonString.substring(1, jsonString.length() - 1));//新供应商(关联表单)
|
|
|
+ List<Map> supplier =(List<Map>) JSONArray.parse(customerJsonString);
|
|
|
+ updateFormInstId = supplier.get(0).get("instanceId").toString();
|
|
|
+ }else {
|
|
|
+ //订单客户
|
|
|
+ String jsonString = formData.get("associationFormField_lzto0clv_id").toString();
|
|
|
+ String customerJsonString = StringEscapeUtils.unescapeJava(jsonString.substring(1, jsonString.length() - 1));
|
|
|
+ List<Map> supplier =(List<Map>) JSONArray.parse(customerJsonString);
|
|
|
+ updateFormInstId = supplier.get(0).get("instanceId").toString();
|
|
|
+
|
|
|
+ String jsonString2 = formData.get("associationFormField_m25llfoy_id").toString();
|
|
|
+ String customerJsonString2 = StringEscapeUtils.unescapeJava(jsonString2.substring(1, jsonString2.length() - 1));
|
|
|
+ formData.put("associationFormField_m25llfoy",customerJsonString2);//关联意向客户
|
|
|
+ }
|
|
|
+
|
|
|
+ formData.put("employeeField_m25inxlq",formData.get("employeeField_m25inxlq_id"));//对接销售
|
|
|
+ formData.put("employeeField_m2cz3vbt",formData.get("employeeField_m2cz3vbt_id"));//关联人员
|
|
|
+
|
|
|
+ String jsonString = formData.get("associationFormField_m0yq620s_id").toString();
|
|
|
+ String currencyJsonString = StringEscapeUtils.unescapeJava(jsonString.substring(1, jsonString.length() - 1));
|
|
|
+ formData.put("associationFormField_m0yq620s",currencyJsonString);//结算币别
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formInstanceId(updateFormInstId)
|
|
|
+ .updateFormDataJson(JSON.toJSONString(formData))
|
|
|
+ .build(),YDConf.FORM_OPERATION.update);
|
|
|
+
|
|
|
+ return McR.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public McR addWeeklyReport(Map map) {
|
|
|
+ if (Objects.isNull(map.get("formInstId"))){
|
|
|
+ return McR.errorParam("formInstId不能为空");
|
|
|
+ }
|
|
|
+ String formInstId = map.get("formInstId").toString();
|
|
|
+ //查询周报计划
|
|
|
+ DDR_New ddrNew = ydClient.queryData(YDParam.builder()
|
|
|
+ .formInstId(formInstId)
|
|
|
+ .build(), YDConf.FORM_QUERY.retrieve_id);
|
|
|
+
|
|
|
+ Map formData = ddrNew.getFormData();
|
|
|
+ //周报发起人
|
|
|
+ List<String> initiateUserIds = (List<String>) formData.get("employeeField_m27e9i5u_id");
|
|
|
+
|
|
|
+ //周报填写人员
|
|
|
+ List<String> weeklyUserIds = (List<String>) formData.get("employeeField_m27e9i5v_id");
|
|
|
+
|
|
|
+ //下次自动发起周报日期
|
|
|
+ long nextTime = (long) formData.get("dateField_m27e9i5w");
|
|
|
+ Date nextDate = new Date(nextTime);
|
|
|
+
|
|
|
+ //汇报日期区间
|
|
|
+ Date startDate = DateUtil.beginOfWeek(nextDate);
|
|
|
+ Date endDate = DateUtil.endOfWeek(nextDate);
|
|
|
+ String startDateTime = startDate.getTime() + "";
|
|
|
+ String endDateTime = endDate.getTime() + "";
|
|
|
+
|
|
|
+ //上次自动发起周报日期
|
|
|
+ Date lastTime = nextDate;
|
|
|
+
|
|
|
+ nextDate = DateUtils.addDays(nextDate, 7);
|
|
|
+
|
|
|
+ Map weeklyFormData = new HashMap();
|
|
|
+ weeklyFormData.put("departmentSelectField_lwprtzha",formData.get("departmentSelectField_m27e9i5t_id"));//部门
|
|
|
+ weeklyFormData.put("dateField_m2d0mach",formData.get("dateField_m27e9i5w"));//汇报开始日期
|
|
|
+ weeklyFormData.put("cascadeDateField_m2cyyp0j",new String[]{startDateTime,endDateTime});//汇报日期区间
|
|
|
+ weeklyFormData.put("numberField_m27dxqle",formData.get("numberField_m27dxqle"));//汇报周
|
|
|
+ weeklyFormData.put("employeeField_m28cj0dq",weeklyUserIds);//周报填写人员
|
|
|
+
|
|
|
+ List<Map> weeklyDetails = new ArrayList<>();
|
|
|
+ for (String weeklyUserId : weeklyUserIds) {
|
|
|
+ Map detail = new HashMap();
|
|
|
+ detail.put("employeeField_m0z2tckk",new String[]{weeklyUserId});//周报人员
|
|
|
+
|
|
|
+ weeklyDetails.add(detail);
|
|
|
+ }
|
|
|
+
|
|
|
+ weeklyFormData.put("tableField_m27dxqla",weeklyDetails);//周报明细
|
|
|
+
|
|
|
+ //发起销售周报
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formUuid("FORM-A68EA411FA5E498490FAC6E4FC30A84F2KN5")
|
|
|
+ .formDataJson(JSON.toJSONString(weeklyFormData))
|
|
|
+ .userId(initiateUserIds.get(0))
|
|
|
+ .build(),YDConf.FORM_OPERATION.create);
|
|
|
+
|
|
|
+ //更新周报计划下次发起周报时间及上次发起周报时间
|
|
|
+ Map updateFormData = new HashMap();
|
|
|
+ updateFormData.put("dateField_m27e9i61", lastTime);
|
|
|
+ updateFormData.put("dateField_m27e9i5w", nextDate);
|
|
|
+
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formInstId(formInstId)
|
|
|
+ .updateFormDataJson(JSON.toJSONString(updateFormData))
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
+
|
|
|
+ return McR.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public McR getTbStageOptions(String projectName,String projectId,String stageName) {
|
|
|
+ List<Map> options = new ArrayList<>();
|
|
|
+
|
|
|
if (Strings.isNullOrEmpty(projectName)){
|
|
|
return McR.errorParam("项目名称不能为空!");
|
|
|
}
|
|
|
- TBR projectTbr = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/project/query", initHeaderToken(), UtilMap.map("name", projectName), TBR.class);
|
|
|
- List<Map> projectList = (List<Map>) projectTbr.getResult();
|
|
|
- if (projectList.isEmpty()){
|
|
|
- return McR.errorParam("项目名称不存在!");
|
|
|
+
|
|
|
+ //根据项目名称获取项目id
|
|
|
+ if (Strings.isNullOrEmpty(projectId)){
|
|
|
+ TBR projectTbr = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/project/query", initHeaderToken(), UtilMap.map("name", projectName), TBR.class);
|
|
|
+ List<Map> projectList = (List<Map>) projectTbr.getResult();
|
|
|
+ if (projectList.isEmpty()){
|
|
|
+ return McR.errorParam("项目名称不存在!");
|
|
|
+ }
|
|
|
+ Map projectMap = projectList.get(0);
|
|
|
+ projectId = projectMap.get("id").toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ //搜索任务列表
|
|
|
+ TBR stageTbr = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/project/"+projectId+"/stage/search", initHeaderToken(), null, TBR.class);
|
|
|
+ List<Map> stageList = (List<Map>) stageTbr.getResult();
|
|
|
+ Map<String,String> stageMap = new HashMap<>();
|
|
|
+ for (Map stage : stageList) {
|
|
|
+ String name = stage.get("name").toString().replaceAll("\\s+","");
|
|
|
+ if (STAGES.contains(name)){
|
|
|
+ stageMap.put(stage.get("id").toString(),name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询父任务详情
|
|
|
+ for (String stageId : stageMap.keySet()) {
|
|
|
+ TBR parentTaskTbr = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/project/" + projectId + "/task/query", initHeaderToken(), UtilMap.map("q", "stageId = " + stageId + " AND taskLayer = onlyTopLevel"), TBR.class);
|
|
|
+ List<Map> parentTaskList = (List<Map>) parentTaskTbr.getResult();
|
|
|
+ for (Map parentTask : parentTaskList) {
|
|
|
+ String content = parentTask.get("content").toString();
|
|
|
+
|
|
|
+ if (content.contains(stageName)) {
|
|
|
+ Map<String,Object> option = new HashMap<>();
|
|
|
+ option.put("text",content);
|
|
|
+ option.put("value",parentTask.get("id").toString());
|
|
|
+ options.add(option);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return McR.success(options);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public McR claimBusinessOpportunities(Map map) {
|
|
|
+ if (Objects.isNull(map.get("formInstId"))){
|
|
|
+ return McR.errorParam("formInstId不能为空");
|
|
|
+ }
|
|
|
+ if (Objects.isNull(map.get("userId"))){
|
|
|
+ return McR.errorParam("userId不能为空");
|
|
|
+ }
|
|
|
+ String formInstId = map.get("formInstId").toString();
|
|
|
+ String userId = map.get("userId").toString();
|
|
|
+ userId = userId.substring(userId.indexOf("\"")+1,userId.lastIndexOf("\""));
|
|
|
+ //更新商机状态和销售人员
|
|
|
+ Map updateFormData = new HashMap();
|
|
|
+ updateFormData.put("selectField_m28uros3","跟进中");
|
|
|
+ updateFormData.put("employeeField_m2a830k8",userId);
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formInstId(formInstId)
|
|
|
+ .updateFormDataJson(JSON.toJSONString(updateFormData))
|
|
|
+ .build(),YDConf.FORM_OPERATION.update);
|
|
|
+
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public McR createTbProject(Map map) {
|
|
|
+ if (Objects.isNull(map.get("name")) || Objects.isNull(map.get("uuid"))){
|
|
|
+ return McR.errorParam("项目名称或项目唯一标识不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ String name = map.get("name").toString();
|
|
|
+ String uuid = map.get("uuid").toString();
|
|
|
+
|
|
|
+ Map body = new HashMap();
|
|
|
+ body.put("name",name);
|
|
|
+ body.put("templateId",templateId);
|
|
|
+ TBR tbr = (TBR) UtilHttp.doPost("https://open.teambition.com/api/v3/project/create-from-template", initHeaderToken(), null,body, TBR.class);
|
|
|
+ Map result = (Map) tbr.getResult();
|
|
|
+ String id = result.get("id").toString();
|
|
|
+
|
|
|
+ //更新项目档案
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formUuid("FORM-B43148BB37324A729A852ED7B40E1A10USDA")
|
|
|
+ .searchCondition(JSON.toJSONString(UtilMap.map("textField_m03860ye",uuid)))
|
|
|
+ .formDataJson(JSON.toJSONString(UtilMap.map("textField_m2cwpzya",id)))
|
|
|
+ .build(),YDConf.FORM_OPERATION.upsert);
|
|
|
+
|
|
|
+ return McR.success(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public McR getTbStageDetails(String projectName,String projectId,String parentTaskId) {
|
|
|
+ Map<String,Object> stageDetail = new HashMap<>();
|
|
|
+ //根据项目名称获取项目id
|
|
|
+ if (Strings.isNullOrEmpty(projectName) || Strings.isNullOrEmpty(parentTaskId)){
|
|
|
+ return McR.errorParam("项目名称或父任务id不能为空!");
|
|
|
+ }
|
|
|
+ if (Strings.isNullOrEmpty(projectId)){
|
|
|
+ TBR projectTbr = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/project/query", initHeaderToken(), UtilMap.map("name", projectName), TBR.class);
|
|
|
+ List<Map> projectList = (List<Map>) projectTbr.getResult();
|
|
|
+ if (projectList.isEmpty()){
|
|
|
+ return McR.errorParam("项目名称不存在!");
|
|
|
+ }
|
|
|
+ Map projectMap = projectList.get(0);
|
|
|
+ projectId = projectMap.get("id").toString();
|
|
|
}
|
|
|
- Map projectMap = projectList.get(0);
|
|
|
- String projectId = projectMap.get("id").toString();
|
|
|
|
|
|
//搜索项目自定义字段
|
|
|
TBR cfTbr = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/project/"+projectId+"/customfield/search", initHeaderToken(), null, TBR.class);
|
|
@@ -920,109 +1157,114 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
Map<String,String> subTaskState = new HashMap<>();
|
|
|
|
|
|
//查询父任务详情
|
|
|
- for (String stageId : stageMap.keySet()) {
|
|
|
- TBR parentTaskTbr = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/project/" + projectId + "/task/query", initHeaderToken(), UtilMap.map("q", "stageId = " + stageId + " AND taskLayer = onlyTopLevel"), TBR.class);
|
|
|
- List<Map> parentTaskList = (List<Map>) parentTaskTbr.getResult();
|
|
|
- for (Map parentTask : parentTaskList) {
|
|
|
- String content = parentTask.get("content").toString();
|
|
|
- String parentTaskId = "";
|
|
|
- if (stageName.equals(content) || ("Tape Out评审".equals(content) && "TO评审".equals(stageName))){
|
|
|
- parentTaskId = parentTask.get("id").toString();
|
|
|
- //查询子任务信息
|
|
|
-
|
|
|
- TBR tbr = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/task/query", initHeaderToken(), UtilMap.map("parentTaskId", parentTaskId), TBR.class);
|
|
|
- List<Map<String, Object>> task = (List<Map<String, Object>>) tbr.getResult();
|
|
|
- List<Map<String, Object>> list = new ArrayList<>();
|
|
|
- boolean flag = true;
|
|
|
- for (Map<String,Object> subTask : task) {
|
|
|
- //获取子任务工作流状态(一个项目同级子任务的工作流id一样 查询一次)
|
|
|
- if (flag){
|
|
|
- String sfcId = subTask.get("sfcId").toString();//任务类型id
|
|
|
- //查询任务类型
|
|
|
- TBR sfcTbr = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/project/"+projectId+"/scenariofieldconfig/search", initHeaderToken(), UtilMap.map("sfcIds", sfcId), TBR.class);
|
|
|
- List<Map> sfcList = (List<Map>) sfcTbr.getResult();
|
|
|
- String taskFlowId = sfcList.get(0).get("taskflowId").toString();//工作流id
|
|
|
- //获取工作流下所有状态节点信息
|
|
|
- TBR tfTbr = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/project/"+projectId+"/taskflowstatus/search", initHeaderToken(), UtilMap.map("tfIds", taskFlowId), TBR.class);
|
|
|
- List<Map> tfList = (List<Map>) tfTbr.getResult();
|
|
|
- for (Map tf : tfList) {
|
|
|
- String name = tf.get("name").toString();
|
|
|
- String tfsId = tf.get("id").toString();
|
|
|
- subTaskState.put(tfsId, name);
|
|
|
- }
|
|
|
- flag = false;
|
|
|
- }
|
|
|
+ TBR tbr = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/task/query", initHeaderToken(), UtilMap.map("parentTaskId", parentTaskId), TBR.class);
|
|
|
+ List<Map<String, Object>> task = (List<Map<String, Object>>) tbr.getResult();
|
|
|
+ List<Map<String, Object>> list = new ArrayList<>();
|
|
|
+ boolean flag = true;
|
|
|
+ for (Map<String,Object> subTask : task) {
|
|
|
+ //获取子任务工作流状态(一个项目同级子任务的工作流id一样 查询一次)
|
|
|
+ if (flag){
|
|
|
+ String sfcId = subTask.get("sfcId").toString();//任务类型id
|
|
|
+ //查询任务类型
|
|
|
+ TBR sfcTbr = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/project/"+projectId+"/scenariofieldconfig/search", initHeaderToken(), UtilMap.map("sfcIds", sfcId), TBR.class);
|
|
|
+ List<Map> sfcList = (List<Map>) sfcTbr.getResult();
|
|
|
+ String taskFlowId = sfcList.get(0).get("taskflowId").toString();//工作流id
|
|
|
+ //获取工作流下所有状态节点信息
|
|
|
+ TBR tfTbr = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/project/"+projectId+"/taskflowstatus/search", initHeaderToken(), UtilMap.map("tfIds", taskFlowId), TBR.class);
|
|
|
+ List<Map> tfList = (List<Map>) tfTbr.getResult();
|
|
|
+ for (Map tf : tfList) {
|
|
|
+ String name = tf.get("name").toString();
|
|
|
+ String tfsId = tf.get("id").toString();
|
|
|
+ subTaskState.put(tfsId, name);
|
|
|
+ }
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
|
|
|
- Map<String,Object> taskDetail = new HashMap<>();
|
|
|
- String content2 = subTask.get("content").toString();
|
|
|
- taskDetail.put("content", content2);
|
|
|
- taskDetail.put("url", TASK_URL_PREFIX + subTask.get("id"));
|
|
|
-
|
|
|
- String tfsId = subTask.get("tfsId").toString();//工作流状态id
|
|
|
- taskDetail.put("state", subTaskState.get(tfsId));//任务状态
|
|
|
-
|
|
|
- List<Map<String,Object>> customfields = (List<Map<String,Object>>) subTask.get("customfields");
|
|
|
- taskDetail.put("dept", "");
|
|
|
- taskDetail.put("part", "");
|
|
|
- taskDetail.put("area", "");
|
|
|
- taskDetail.put("file", "");
|
|
|
- taskDetail.put("file2", "");
|
|
|
- if (!customfields.isEmpty()){
|
|
|
- for (Map<String, Object> customfield : customfields) {
|
|
|
- String cfId = customfield.get("cfId").toString();
|
|
|
- if (cfMap.containsKey(cfId)){
|
|
|
- String cfName = cfMap.get(cfId);
|
|
|
- List<Map<String, Object>> value = (List<Map<String, Object>>) customfield.get("value");
|
|
|
- if (!value.isEmpty()){
|
|
|
- String title = value.get(0).get("title").toString();
|
|
|
- taskDetail.put(cfName, title);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ Map<String,Object> taskDetail = new HashMap<>();
|
|
|
+ String content2 = subTask.get("content").toString();
|
|
|
+ taskDetail.put("content", content2);
|
|
|
+ taskDetail.put("url", TASK_URL_PREFIX + subTask.get("id"));
|
|
|
+
|
|
|
+ String tfsId = subTask.get("tfsId").toString();//工作流状态id
|
|
|
+ taskDetail.put("state", subTaskState.get(tfsId));//任务状态
|
|
|
+
|
|
|
+ List<Map<String,Object>> customfields = (List<Map<String,Object>>) subTask.get("customfields");
|
|
|
+ taskDetail.put("dept", "");
|
|
|
+ taskDetail.put("part", "");
|
|
|
+ taskDetail.put("area", "");
|
|
|
+ taskDetail.put("file", "");
|
|
|
+ taskDetail.put("file2", "");
|
|
|
+ if (!customfields.isEmpty()){
|
|
|
+ for (Map<String, Object> customfield : customfields) {
|
|
|
+ String cfId = customfield.get("cfId").toString();
|
|
|
+ if (cfMap.containsKey(cfId)){
|
|
|
+ String cfName = cfMap.get(cfId);
|
|
|
+ List<Map<String, Object>> value = (List<Map<String, Object>>) customfield.get("value");
|
|
|
+ if (!value.isEmpty()){
|
|
|
+ String title = value.get(0).get("title").toString();
|
|
|
+ taskDetail.put(cfName, title);
|
|
|
}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- taskDetail.put("carTag", "");
|
|
|
- taskDetail.put("payTag", "");
|
|
|
- List<String> tagIds = (List<String>) subTask.get("tagIds");
|
|
|
- if (!tagIds.isEmpty()){
|
|
|
- for (String tagId : tagIds) {
|
|
|
- if (tagMap.containsKey(tagId)) {
|
|
|
- if (tagMap.get(tagId).contains("车载")){
|
|
|
- taskDetail.put("carTag", tagMap.get(tagId).substring(3,5));
|
|
|
- }else if (tagMap.get(tagId).contains("消费")){
|
|
|
- taskDetail.put("payTag", tagMap.get(tagId).substring(3,5));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ taskDetail.put("carTag", "");
|
|
|
+ taskDetail.put("payTag", "");
|
|
|
+ List<String> tagIds = (List<String>) subTask.get("tagIds");
|
|
|
+ if (!tagIds.isEmpty()){
|
|
|
+ for (String tagId : tagIds) {
|
|
|
+ if (tagMap.containsKey(tagId)) {
|
|
|
+ if (tagMap.get(tagId).contains("车载")){
|
|
|
+ taskDetail.put("carTag", tagMap.get(tagId).substring(3,5));
|
|
|
+ }else if (tagMap.get(tagId).contains("消费")){
|
|
|
+ taskDetail.put("payTag", tagMap.get(tagId).substring(3,5));
|
|
|
}
|
|
|
-
|
|
|
- list.add(taskDetail);
|
|
|
}
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- //获取父任务工作流状态
|
|
|
- TBR tbr2 = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/task/query", initHeaderToken(), UtilMap.map("taskId", parentTaskId), TBR.class);
|
|
|
- List<Map<String, Object>> result2 = (List<Map<String, Object>>) tbr2.getResult();
|
|
|
- String sfcId = result2.get(0).get("sfcId").toString();
|
|
|
- String tfsId = result2.get(0).get("tfsId").toString();
|
|
|
-
|
|
|
- TBR tbr3 = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/project/"+projectId+"/scenariofieldconfig/search", initHeaderToken(), UtilMap.map("sfcIds", sfcId), TBR.class);
|
|
|
- List<Map<String, Object>> result3 = (List<Map<String, Object>>) tbr3.getResult();
|
|
|
- String taskflowId = result3.get(0).get("taskflowId").toString();
|
|
|
-
|
|
|
- TBR tbr4 = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/project/" + projectId + "/taskflowstatus/search", initHeaderToken(), UtilMap.map("tfIds", taskflowId), TBR.class);
|
|
|
- List<Map<String, Object>> result4 = (List<Map<String, Object>>) tbr4.getResult();
|
|
|
- result4.forEach(tf -> {
|
|
|
- if (tf.get("id").toString().equals(tfsId)){
|
|
|
- stageDetail.put("state", tf.get("name").toString());
|
|
|
- }
|
|
|
- });
|
|
|
+ list.add(taskDetail);
|
|
|
+ }
|
|
|
|
|
|
- stageDetail.put("list",list);
|
|
|
+ //获取父任务工作流状态
|
|
|
+ TBR tbr2 = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/task/query", initHeaderToken(), UtilMap.map("taskId", parentTaskId), TBR.class);
|
|
|
+ List<Map<String, Object>> result2 = (List<Map<String, Object>>) tbr2.getResult();
|
|
|
+ String sfcId = result2.get(0).get("sfcId").toString();
|
|
|
+ String tfsId = result2.get(0).get("tfsId").toString();
|
|
|
+
|
|
|
+ TBR tbr3 = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/project/"+projectId+"/scenariofieldconfig/search", initHeaderToken(), UtilMap.map("sfcIds", sfcId), TBR.class);
|
|
|
+ List<Map<String, Object>> result3 = (List<Map<String, Object>>) tbr3.getResult();
|
|
|
+ String taskflowId = result3.get(0).get("taskflowId").toString();
|
|
|
+
|
|
|
+ TBR tbr4 = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/project/" + projectId + "/taskflowstatus/search", initHeaderToken(), UtilMap.map("tfIds", taskflowId), TBR.class);
|
|
|
+ List<Map<String, Object>> result4 = (List<Map<String, Object>>) tbr4.getResult();
|
|
|
+ result4.forEach(tf -> {
|
|
|
+ if (tf.get("id").toString().equals(tfsId)){
|
|
|
+ stageDetail.put("state", tf.get("name").toString());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ stageDetail.put("list",list);
|
|
|
+
|
|
|
+
|
|
|
+ /*if (stageName.equals(content)){
|
|
|
+ parentTaskId = parentTask.get("id").toString();
|
|
|
+ //查询子任务信息
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ break;
|
|
|
+ }*/
|
|
|
+
|
|
|
+/* for (String stageId : stageMap.keySet()) {
|
|
|
+ TBR parentTaskTbr = (TBR) UtilHttp.doGet("https://open.teambition.com/api/v3/project/" + projectId + "/task/query", initHeaderToken(), UtilMap.map("q", "stageId = " + stageId + " AND taskLayer = onlyTopLevel"), TBR.class);
|
|
|
+ List<Map> parentTaskList = (List<Map>) parentTaskTbr.getResult();
|
|
|
+ for (Map parentTask : parentTaskList) {
|
|
|
+ String content = parentTask.get("content").toString();
|
|
|
+ String parentTaskId = "";
|
|
|
|
|
|
- break;
|
|
|
- }
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
return McR.success(stageDetail);
|
|
|
}
|
|
@@ -1032,6 +1274,7 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
header.put("Authorization", this.getAccessToken());
|
|
|
header.put("X-Tenant-Id", this.tbConf.getTenantId());
|
|
|
header.put("X-Tenant-Type", "organization");
|
|
|
+ header.put("x-operator-id", this.tbConf.getOperatorId());
|
|
|
return header;
|
|
|
}
|
|
|
|