|
@@ -109,4 +109,121 @@ public Map doCheck(String taskId, boolean isTask) {
|
|
|
Map body2 = TBConf.assembleCustomFieldName(AWServer.TASK_CHECK_LINK, result);
|
|
|
tbClient.updateTaskCustomField(String.valueOf(data.get("taskId")), tbConf.getOperatorId(), body2);
|
|
|
_updateApproveField(UtilMap.getString(data, "taskId"), new ArrayList<>(), result, title, "已提交", AWServer.TASK_CHECK_LINK);
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+public Map doCheck(String taskId, boolean isTask) {
|
|
|
+
|
|
|
+ log.info("检查项check {}, isTask {}", taskId, isTask);
|
|
|
+ Map taskData = _getTaskFieldMap(taskId, AWServer.TASK_CODE, AWServer.TASK_CHECK_LINK, AWServer.TASK_ROLE, AWServer.TASK_STAGE, AWServer.TASK_CHECK_STATUS, AWServer.TASK_PRODUCT, AWServer.TASK_PRODUCT_VERSION);
|
|
|
+ Map rTask = UtilMap.getMap(taskData, "task");
|
|
|
+ String pCode = UtilMap.getString(rTask, "projectId");
|
|
|
+ if (AWServer.PROJECT_IGNORE_ID.contains(pCode)) {
|
|
|
+ return UtilMap.map("result", "模板/复用项目");
|
|
|
+ }
|
|
|
+ String checkLink = UtilMap.getString(taskData, AWServer.TASK_CHECK_LINK);
|
|
|
+ /// prd 7.17 预检项任务ID与当前任务ID不匹配,判定为非法, 无需重新刷新
|
|
|
+ if (isTask) {
|
|
|
+ if (!(checkLink.contains("?taskId=") && !checkLink.contains(taskId))) {
|
|
|
+ /// prd 预检项持续维护需要重新匹配, 任务号和主数据判定为非法, 无需重新刷新
|
|
|
+ if (StringUtils.isNotBlank(checkLink) && !AWServer.TASK_CHECK_LINK_OK.equals(checkLink)) {
|
|
|
+ return UtilMap.map("result", "链接已加载");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // prd 非未完成任务若是未配置预检项状态, 忽略更新
|
|
|
+ if (isTask && !_getWorkFlowStatusList(pCode, AWServer.WORKFLOW_INITIAL).contains(rTask.get("tfsId"))) {
|
|
|
+ return UtilMap.map("result", "任务已执行");
|
|
|
+ }
|
|
|
+ // prd 7.17 creatorId 创建人修改为 执行人 executorId
|
|
|
+ String executorId = UtilMap.getString(rTask, "executorId");
|
|
|
+ String tCode = UtilMap.getString(taskData, AWServer.TASK_CODE);
|
|
|
+
|
|
|
+ String resultTitle = "", resultUrl = "";
|
|
|
+ List<Map> tList = null;
|
|
|
+ Map rProject = null;
|
|
|
+ if (StringUtils.isBlank(tCode)) {
|
|
|
+ resultTitle = "无任务编码";
|
|
|
+ } 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) {
|
|
|
+ resultTitle = "未匹配到项目主数据";
|
|
|
+ } else {
|
|
|
+ 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) {
|
|
|
+ resultTitle = "未配置预检项";
|
|
|
+ } else {
|
|
|
+ resultTitle = AWServer.TASK_CHECK_LINK_OK;
|
|
|
+ resultUrl = _matchFormUuid("DOMAIN") + ydConf.getAppType() + "/workbench/" + _matchFormUuid("RECORD") + "?taskId=" + taskId;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ log.info("检查项结果, {},{}", resultTitle, resultUrl);
|
|
|
+ String result = resultTitle.equals(AWServer.TASK_CHECK_LINK_OK) ? resultUrl : resultTitle;
|
|
|
+ if (isTask) {
|
|
|
+ if (!result.equals(checkLink)) {
|
|
|
+ Map body = TBConf.assembleCustomFieldName(AWServer.TASK_CHECK_LINK, result);
|
|
|
+ tbClient.updateTaskCustomField(taskId, tbConf.getOperatorId(), body);
|
|
|
+ // prd 7.17 技术检查项从未匹配到更新,刷新检查状态为空
|
|
|
+ if (resultTitle.equals(AWServer.TASK_CHECK_LINK_OK) && (checkLink.equals("未配置预检项") || checkLink.equals(""))) {
|
|
|
+ Map body2 = TBConf.assembleCustomFieldName(AWServer.TASK_CHECK_STATUS);
|
|
|
+ tbClient.updateTaskCustomField(taskId, tbConf.getOperatorId(), body2);
|
|
|
+ }
|
|
|
+// _updateApproveField(taskId, new ArrayList<>(), resultUrl, resultTitle, "待提交", AWServer.TASK_CHECK_LINK);
|
|
|
+ }
|
|
|
+ // prd 未配置预检项更新为已检查, 避免完成任务完成触发必填校验 [ppExt 避免重复写入, 重复写入TB会重复记录日志
|
|
|
+ if (!resultTitle.equals(AWServer.TASK_CHECK_LINK_OK) && !taskData.get(AWServer.TASK_CHECK_STATUS).equals("已检查")) {
|
|
|
+ Map body = TBConf.assembleCustomFieldName(AWServer.TASK_CHECK_STATUS, "已检查");
|
|
|
+ tbClient.updateTaskCustomField(taskId, tbConf.getOperatorId(), body);
|
|
|
+ }
|
|
|
+ return UtilMap.map("result", result);
|
|
|
+ }
|
|
|
+ // prd 7.17 添加执行人为空校验
|
|
|
+ McException.assertAccessException(StringUtils.isBlank(executorId), "执行人不能为空!");
|
|
|
+ McException.assertAccessException(!resultTitle.equals("技术检查确认"), resultTitle);
|
|
|
+
|
|
|
+ Map formData = UtilMap.map("selectField_lqxuswzd, textField_lrndwu00, textField_lr3dlwsa, textField_lr3er4qb", tCode, pCode, taskId, executorId);
|
|
|
+ // 项目信息
|
|
|
+ formData.putAll(UtilMap.map("selectField_lqxuswze, textField_lrndwu07, textField_lqxuc9m4", UtilMap.getString(rProject, "textField_lrj7vnxb"), UtilMap.getString(rProject, "textareaField_lrj7vnxl"), UtilMap.getString(rProject, "textField_lqxtykcd")));
|
|
|
+ // 任务信息 [TBManager 操作]
|
|
|
+ Map<String, String> extra = (Map) tbClient.idMapQuery(executorId, "dingTalk-user", ddConf.getCorpId()).get(0).get("extra");
|
|
|
+ // ppExt: TB映射钉钉信息仅返回 userId, 人员组件返回前端展示需要 name. 通过页面公式临时自动加载, 可通过TB接口或钉钉用户接口查询
|
|
|
+ formData.putAll(UtilMap.map("textField_lrndwu09, textField_lrndwu0a, textField_lrndwu0b, employeeField_lrndwu0e, textField_lvbrueqs, textField_lvbrueqt", rTask.get("content"), taskData.get(AWServer.TASK_STAGE), taskData.get(AWServer.TASK_ROLE), Arrays.asList(UtilMap.map("value, name", extra.get("userId"), extra.get("userId"))), taskData.get(AWServer.TASK_PRODUCT), taskData.get(AWServer.TASK_PRODUCT_VERSION)));
|
|
|
+ // 返回检查项
|
|
|
+ formData.put("tableField_lqxxgj4s", tList.stream().map(item -> {
|
|
|
+ item.put("associationFormField_lrrnem5r", YDConf.associationForm(ydConf.getAppType(), _matchFormUuid("CHECK"), UtilMap.getString(item, "instanceId"), UtilMap.getString(item, "textField_lrnd3h0r"), "", false));
|
|
|
+ return item;
|
|
|
+ }).collect(Collectors.toList()));
|
|
|
+ // prd 7.17 技术检查项需要匹配userId
|
|
|
+ formData.put("userId", extra.get("userId"));
|
|
|
+ return formData;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检查项回调
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void checked(Map data) {
|
|
|
+
|
|
|
+ log.info("检查项回调, {}", data);
|
|
|
+ String title = UtilMap.getString(data, "title");
|
|
|
+ Map body = TBConf.assembleCustomFieldName(AWServer.TASK_CHECK_STATUS, "已检查");
|
|
|
+ tbClient.updateTaskCustomField(String.valueOf(data.get("taskId")), tbConf.getOperatorId(), body);
|
|
|
+ String result = _matchFormUuid("DOMAIN") + ydConf.getAppType() + "/formDetail?formInstId=" + data.get("formInstId");
|
|
|
+ Map body2 = TBConf.assembleCustomFieldName(AWServer.TASK_CHECK_LINK, result);
|
|
|
+ tbClient.updateTaskCustomField(String.valueOf(data.get("taskId")), tbConf.getOperatorId(), body2);
|
|
|
+// _updateApproveField(UtilMap.getString(data, "taskId"), new ArrayList<>(), result, title, "已提交", AWServer.TASK_CHECK_LINK);
|
|
|
+ }
|