|
@@ -18,7 +18,6 @@ import com.malk.utils.*;
|
|
|
import lombok.Synchronized;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.checkerframework.checker.units.qual.A;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -53,6 +52,7 @@ public class AWImplClient implements AWClint {
|
|
|
formUuid.put("RECORD", "FORM-6E2C0D1197264B8AA23EB3FECAE7344B00BN"); // 预检项记录
|
|
|
formUuid.put("ROLE", "FORM-3C7396A12ADB48A8833EBD90089C93833R21"); // 项目角色
|
|
|
formUuid.put("CRM_LOG", "FORM-16DD578308E64763AE1539D8176CCCD0GX6F"); // crm推送日志
|
|
|
+ formUuid.put("TEMPLATE", "FORM-24EFE5C1BCE54E7192E53B33ADFBF1C52NS3"); // TB模板与项目类型映射表
|
|
|
formUuid.put("DOMAIN", "https://yida.awinic.com/"); // 宜搭域名
|
|
|
} else {
|
|
|
// [ fixme: 测试环境添加主数据, 匹配不同架构下企业成员 ]
|
|
@@ -64,6 +64,7 @@ public class AWImplClient implements AWClint {
|
|
|
formUuid.put("RECORD", "FORM-7B63BB056145452F8BC0A2C52492DE00QVBH");
|
|
|
formUuid.put("ROLE", "FORM-5BE21392886E46DF955D1EBC100ADA429NON");
|
|
|
formUuid.put("CRM_LOG", "FORM-7F40E85D4FA8487C8E00C9156B76A953CBMG");
|
|
|
+ formUuid.put("TEMPLATE", "FORM-C864290977A64FC4A061434DF21D5871JA04");
|
|
|
formUuid.put("DOMAIN", "https://kabom7.aliwork.com/");
|
|
|
}
|
|
|
return formUuid.get(code);
|
|
@@ -102,17 +103,18 @@ public class AWImplClient implements AWClint {
|
|
|
if (StringUtils.isBlank(tCode)) {
|
|
|
result = "无任务编码";
|
|
|
} else {
|
|
|
- tList = ydService.queryDataList_FormData(_matchFormUuid("APPROVE"), UtilMap.map("selectField_lrncf4hk, radioField_lrnddfq6", tCode, "启用"));
|
|
|
- tList = tList.stream().filter(item -> tCode.equals(item.get("selectField_lrncf4hk"))).collect(Collectors.toList());
|
|
|
- if (tList.size() == 0) {
|
|
|
- result = "未配置交付物审批";
|
|
|
+ List<Map> pList = ydService.queryDataList_FormData(_matchFormUuid("PROJECT"), UtilMap.map("textField_lqxtykce", pCode));
|
|
|
+ pList = pList.stream().filter(item -> pCode.equals(item.get("textField_lqxtykce"))).collect(Collectors.toList());
|
|
|
+ if (pList.size() == 0) {
|
|
|
+ result = "未匹配到项目主数据";
|
|
|
} else {
|
|
|
- List<Map> pList = ydService.queryDataList_FormData(_matchFormUuid("PROJECT"), UtilMap.map("textField_lqxtykce", pCode));
|
|
|
- pList = pList.stream().filter(item -> pCode.equals(item.get("textField_lqxtykce"))).collect(Collectors.toList());
|
|
|
- if (pList.size() == 0) {
|
|
|
- result = "未匹配到项目主数据";
|
|
|
- } else {
|
|
|
- rProject = pList.get(0);
|
|
|
+ rProject = pList.get(0);
|
|
|
+ // prd 多模板适配: [任务号 + 项目类型]
|
|
|
+ String proType = UtilMap.getString(rProject, "textField_ltwcq7s6");
|
|
|
+ tList = ydService.queryDataList_FormData(_matchFormUuid("APPROVE"), UtilMap.map("selectField_lrncf4hk, radioField_lrnddfq6", tCode, "启用"));
|
|
|
+ tList = tList.stream().filter(item -> tCode.equals(item.get("selectField_lrncf4hk")) && UtilMap.getList(item, "multiSelectField_ltwjre9s").contains(proType)).collect(Collectors.toList());
|
|
|
+ if (tList.size() == 0) {
|
|
|
+ result = "未配置交付物审批";
|
|
|
}
|
|
|
}
|
|
|
/// 发起评审
|
|
@@ -295,20 +297,22 @@ public class AWImplClient implements AWClint {
|
|
|
if (StringUtils.isBlank(tCode)) {
|
|
|
result = "无任务编码";
|
|
|
} else {
|
|
|
- tList = ydService.queryFormData_all(YDParam.builder()
|
|
|
- .formUuid(_matchFormUuid("CHECK"))
|
|
|
- .searchFieldJson(JSON.toJSONString(UtilMap.map("selectField_lrncf4hk, radioField_lrnddfq6", tCode, "启用")))
|
|
|
- .build());
|
|
|
- tList = tList.stream().filter(item -> tCode.equals(item.get("selectField_lrncf4hk"))).collect(Collectors.toList());
|
|
|
- if (tList.size() == 0) {
|
|
|
- result = "未配置预检项";
|
|
|
+ List<Map> pList = ydService.queryDataList_FormData(_matchFormUuid("PROJECT"), UtilMap.map("textField_lqxtykce", pCode));
|
|
|
+ pList = pList.stream().filter(item -> pCode.equals(item.get("textField_lqxtykce"))).collect(Collectors.toList());
|
|
|
+ if (pList.size() == 0) {
|
|
|
+ result = "未匹配到项目主数据";
|
|
|
} else {
|
|
|
- List<Map> pList = ydService.queryDataList_FormData(_matchFormUuid("PROJECT"), UtilMap.map("textField_lqxtykce", pCode));
|
|
|
- pList = pList.stream().filter(item -> pCode.equals(item.get("textField_lqxtykce"))).collect(Collectors.toList());
|
|
|
- if (pList.size() == 0) {
|
|
|
- result = "未匹配到项目主数据";
|
|
|
+ rProject = pList.get(0);
|
|
|
+ String proType = UtilMap.getString(rProject, "textField_ltwcq7s6");
|
|
|
+ tList = ydService.queryFormData_all(YDParam.builder()
|
|
|
+ .formUuid(_matchFormUuid("CHECK"))
|
|
|
+ .searchFieldJson(JSON.toJSONString(UtilMap.map("selectField_lrncf4hk, radioField_lrnddfq6", tCode, "启用")))
|
|
|
+ .build());
|
|
|
+ // prd 多模板适配: [任务号 + 项目类型]
|
|
|
+ tList = tList.stream().filter(item -> tCode.equals(item.get("selectField_lrncf4hk")) && UtilMap.getList(item, "multiSelectField_ltwjre9s").contains(proType)).collect(Collectors.toList());
|
|
|
+ if (tList.size() == 0) {
|
|
|
+ result = "未配置预检项";
|
|
|
} else {
|
|
|
- rProject = pList.get(0);
|
|
|
result = _matchFormUuid("DOMAIN") + ydConf.getAppType() + "/workbench/" + _matchFormUuid("RECORD") + "?taskId=" + taskId;
|
|
|
}
|
|
|
}
|
|
@@ -326,7 +330,7 @@ public class AWImplClient implements AWClint {
|
|
|
}
|
|
|
return UtilMap.map("result", result);
|
|
|
}
|
|
|
- McException.assertAccessException(ObjectUtil.isNull(rProject), result);
|
|
|
+ McException.assertAccessException(!result.startsWith("https://"), result);
|
|
|
|
|
|
Map formData = UtilMap.map("selectField_lqxuswzd, textField_lrndwu00, textField_lr3dlwsa, textField_lr3er4qb", tCode, pCode, taskId, creatorId);
|
|
|
// 项目信息
|
|
@@ -473,6 +477,15 @@ public class AWImplClient implements AWClint {
|
|
|
if (StringUtils.isBlank(projectId)) {
|
|
|
Map upMap=UtilMap.map("textField_lqxtykce", projectId);
|
|
|
awDingService.saveGroup(upMap,formData);
|
|
|
+
|
|
|
+ // prd 多模板适配: [templateId 为空, 触发项目类型匹配]
|
|
|
+ if (StringUtils.isBlank(templateId)) {
|
|
|
+ List<Map> dataList = ydService.queryDataList_FormData(_matchFormUuid("TEMPLATE"), null);
|
|
|
+ Optional optional = dataList.stream().filter(item -> item.get("selectField_ltwcsr8w").equals(formData.get("textField_ltwcq7s6"))).findAny();
|
|
|
+ McException.assertAccessException(!optional.isPresent(), projectCode + ": TB项目模板未维护!");
|
|
|
+ templateId = UtilMap.getString((Map) optional.get(), "textField_ltwcybz1");
|
|
|
+ McException.assertAccessException(templateId.length() <= 1, projectCode + ": TB项目模板未匹配!");
|
|
|
+ }
|
|
|
// 通过模板创建项目, 创建项目并更新项目TB项目ID
|
|
|
Map result = tbClient.projectCreateWithTemplate(projectCode, templateId, tbConf.getOperatorId());
|
|
|
projectId = UtilMap.getString(result, "id");
|
|
@@ -603,7 +616,6 @@ public class AWImplClient implements AWClint {
|
|
|
if (!optional2.isPresent()) {
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
// prd 传递无TR评审节点值, 匹配空值, 作为分配条件
|
|
|
String trName = TBConf.getTaskFieldValue_First(customfields, UtilMap.getString((Map) optional2.get(), "id"));
|
|
|
if (StringUtils.isBlank(trName)) {
|
|
@@ -648,7 +660,6 @@ public class AWImplClient implements AWClint {
|
|
|
@Synchronized
|
|
|
@Override
|
|
|
public void removeDependencies(String projectId, List<String> trNode) {
|
|
|
-
|
|
|
// 任务编码字段ID
|
|
|
List<Map> customField = tbClient.queryProjectCustomField(projectId, null);
|
|
|
tbClient.queryProjectTaskList(projectId, null, taskList -> {
|
|
@@ -706,6 +717,9 @@ public class AWImplClient implements AWClint {
|
|
|
String C_TR5_03_13 = "TR5-03-13";
|
|
|
String C_TR6_01_11 = "TR6-01-11";
|
|
|
|
|
|
+ // prd 推CRM的逻辑, 完成时间晚于2024/3/29的就更新,否则不更新
|
|
|
+ Date dlDate = UtilDateTime.parseDateTime("2024-03-29 23:59:59");
|
|
|
+
|
|
|
// 7. 产品型号 (Name) : 以上计划时间对应的产品型号 / 取产品型号字段
|
|
|
List<Map> customField = tbClient.queryProjectCustomField(projectId, null);
|
|
|
|
|
@@ -740,19 +754,28 @@ public class AWImplClient implements AWClint {
|
|
|
// 2. 预计α推广 (AlphaDate): 最新项目计划(非基线)里的ADCPα任务对应的计划完成时间 / TR5-03-13任务号 取最新版本
|
|
|
String date = UtilMap.getString(task, "dueDate");
|
|
|
if (UtilString.isNotBlankCompatNull(date)) {
|
|
|
- tData.put("AlphaDate", UtilDateTime.formatDate(UtilDateTime.parse(date, UtilDateTime.DATE_MSEL_ISO)));
|
|
|
+ Date tDate = UtilDateTime.parse(date, UtilDateTime.DATE_MSEL_ISO);
|
|
|
+ if (tDate.after(dlDate)) {
|
|
|
+ tData.put("AlphaDate", UtilDateTime.formatDate(tDate));
|
|
|
+ }
|
|
|
}
|
|
|
// 3. α推广 (AlphaDate2): 【ADCPα】对应的实际完成时间 / TR5-03-13任务号 取最新版本
|
|
|
date = UtilMap.getString(task, "accomplishTime");
|
|
|
if (UtilString.isNotBlankCompatNull(date)) {
|
|
|
- tData.put("AlphaDate2", UtilDateTime.formatDate(UtilDateTime.parse(date, UtilDateTime.DATE_MSEL_ISO)));
|
|
|
+ Date tDate = UtilDateTime.parse(date, UtilDateTime.DATE_MSEL_ISO);
|
|
|
+ if (tDate.after(dlDate)) {
|
|
|
+ tData.put("AlphaDate2", UtilDateTime.formatDate(tDate));
|
|
|
+ }
|
|
|
}
|
|
|
// 1. α推广基线 (AlphaBaseline): PDCP basseline 基线下的ADCPα任务的计划完成时间 / PDCP basseline 基线 TR5-03-13任务号
|
|
|
Optional optional = baseLineTaskList.stream().filter(item -> task.get("id").equals(item.get("id"))).findAny();
|
|
|
if (optional.isPresent()) {
|
|
|
date = UtilMap.getString((Map) optional.get(), "planDueDate");
|
|
|
if (StringUtils.isNotBlank(date)) {
|
|
|
- tData.put("AlphaBaseline", UtilDateTime.formatDate(UtilDateTime.parse(date, UtilDateTime.DATE_MSEL_ISO)));
|
|
|
+ Date tDate = UtilDateTime.parse(date, UtilDateTime.DATE_MSEL_ISO);
|
|
|
+ if (tDate.after(dlDate)) {
|
|
|
+ tData.put("AlphaBaseline", UtilDateTime.formatDate(tDate));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (tData.keySet().size() >= 2) {
|
|
@@ -776,19 +799,28 @@ public class AWImplClient implements AWClint {
|
|
|
// 5. 预计正式发布 (AgentSampleDate): 最新项目计划(非基线),取最早那个产品版本的计划完成时间 / TR6-01-11任务号 最早版本
|
|
|
String date = UtilMap.getString(task, "dueDate");
|
|
|
if (UtilString.isNotBlankCompatNull(date)) {
|
|
|
- tData.put("AgentSampleDate", UtilDateTime.formatDate(UtilDateTime.parse(date, UtilDateTime.DATE_MSEL_ISO)));
|
|
|
+ Date tDate = UtilDateTime.parse(date, UtilDateTime.DATE_MSEL_ISO);
|
|
|
+ if (tDate.after(dlDate)) {
|
|
|
+ tData.put("AgentSampleDate", UtilDateTime.formatDate(tDate));
|
|
|
+ }
|
|
|
}
|
|
|
// 6. 正式发布 (ProductSendDate): 【ADCP】对应的取最早那个产品版本的实际完成时间 / TR6-01-11任务号 最早版本
|
|
|
date = UtilMap.getString(task, "accomplishTime");
|
|
|
if (UtilString.isNotBlankCompatNull(date)) {
|
|
|
- tData.put("ProductSendDate", UtilDateTime.formatDate(UtilDateTime.parse(date, UtilDateTime.DATE_MSEL_ISO)));
|
|
|
+ Date tDate = UtilDateTime.parse(date, UtilDateTime.DATE_MSEL_ISO);
|
|
|
+ if (tDate.after(dlDate)) {
|
|
|
+ tData.put("ProductSendDate", UtilDateTime.formatDate(tDate));
|
|
|
+ }
|
|
|
}
|
|
|
// 4. 正式发布基线 (ReleaseBaseline): 取PDCPbasseline基线里的ADCP的计划完成时间,取最早那个产品版本的计划完成时间 / PDCP basseline 基线 TR6-01-11任务号
|
|
|
Optional optional = baseLineTaskList.stream().filter(item -> task.get("id").equals(item.get("id"))).findAny();
|
|
|
if (optional.isPresent()) {
|
|
|
date = UtilMap.getString((Map) optional.get(), "planDueDate");
|
|
|
if (StringUtils.isNotBlank(date)) {
|
|
|
- tData.put("ReleaseBaseline", UtilDateTime.formatDate(UtilDateTime.parse(date, UtilDateTime.DATE_MSEL_ISO)));
|
|
|
+ Date tDate = UtilDateTime.parse(date, UtilDateTime.DATE_MSEL_ISO);
|
|
|
+ if (tDate.after(dlDate)) {
|
|
|
+ tData.put("ReleaseBaseline", UtilDateTime.formatDate(tDate));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (tData.keySet().size() >= 2) {
|
|
@@ -796,7 +828,6 @@ public class AWImplClient implements AWClint {
|
|
|
_pushCRM(projectId, tData);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// 推送crm: prd 单次推送必须为相同料号
|
|
@@ -844,6 +875,48 @@ public class AWImplClient implements AWClint {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改任务自定义字段内容
|
|
|
+ *
|
|
|
+ * @param projectId 1. 若为空, 触发全量修改; 2. 仅修改非未完成任务
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void batchUpdate(String fieldName, String preName, String modifyName, String projectId) {
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(projectId)) {
|
|
|
+ // prd 同步修改: 项目状态为执行 & TB项目号不为空
|
|
|
+ YDParam ydParam = YDParam.builder()
|
|
|
+ .formUuid(_matchFormUuid("PROJECT"))
|
|
|
+ .searchFieldJson(JSON.toJSONString(UtilMap.map("textField_llouhiyf", "执行")))
|
|
|
+ .build();
|
|
|
+ List<Map> proList = ydService.queryFormData_all(ydParam);
|
|
|
+ for (Map pro : proList) {
|
|
|
+ String _projectId = UtilMap.getString(pro, "textField_lqxtykce");
|
|
|
+ if (StringUtils.isBlank(_projectId)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ _batchUpdate(fieldName, preName, modifyName, _projectId);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ _batchUpdate(fieldName, preName, modifyName, projectId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 修改任务自定义字段
|
|
|
+ void _batchUpdate(String fieldName, String preName, String modifyName, String projectId) {
|
|
|
+ // prd 非未完成任务字段ID
|
|
|
+ List<String> workFlowStatusList = _getWorkFlowStatusList(projectId, AWServer.WORKFLOW_INITIAL);
|
|
|
+
|
|
|
+ Map<String, String> proData = getProjectCFID(projectId, Arrays.asList(fieldName));
|
|
|
+ String tql = "cf:" + proData.get(fieldName) + " = " + preName + " AND tfsId IN (" + String.join(", ", workFlowStatusList) + ")";
|
|
|
+
|
|
|
+ List<Map> taskList = tbClient.queryProjectTaskList(projectId, UtilMap.put(UtilMap.empty(), "q", tql), null);
|
|
|
+ for (Map task : taskList) {
|
|
|
+ Map body = TBConf.assembleCustomFieldName(fieldName, modifyName);
|
|
|
+ tbClient.updateTaskCustomField(UtilMap.getString(task, "id"), tbConf.getOperatorId(), body);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 同步预检项 [全量同步, 忽略任务号为空记录]
|
|
|
*/
|
|
@@ -949,7 +1022,6 @@ public class AWImplClient implements AWClint {
|
|
|
@Override
|
|
|
public void test() {
|
|
|
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|