|
|
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.malk.delegate.TBEvent;
|
|
|
import com.malk.server.common.McException;
|
|
|
import com.malk.service.teambition.TBClient;
|
|
|
+import com.malk.utils.PublicUtil;
|
|
|
import com.malk.utils.UtilMap;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -84,7 +85,8 @@ public class McTbEventImpl implements TBEvent {
|
|
|
String creatorId = "61a8c27a143030d9110a66d4";
|
|
|
List<Map> list=tbClient.queryNodeList(taskId);
|
|
|
Map node = _getNodeDetail(list,nodeId);
|
|
|
- if(String.valueOf(node.get("name")).contains("设计接单")){
|
|
|
+ String nodeName =getContainsName(String.valueOf(node.get("name")));
|
|
|
+ if(!PublicUtil.isNull(nodeName)){
|
|
|
try {
|
|
|
Thread.sleep(3000);
|
|
|
}catch (InterruptedException e){
|
|
|
@@ -92,13 +94,30 @@ public class McTbEventImpl implements TBEvent {
|
|
|
}
|
|
|
boolean isDue = event.equals("v3.task.node.dueDate.update");
|
|
|
String date = data.getString(isDue?"dueDate":"startDate");
|
|
|
- String key = isDue?"设计截止时间":"设计开始时间";
|
|
|
- log.info("XXXXXX 设计接单时间变更,更新任务{}:{}-{}",key,taskId,date);
|
|
|
+ String key = NODE_FIELDNAME.get(nodeName)[isDue?0:1];
|
|
|
+ log.info("XXXXXX {}时间变更,更新任务{}:{}-{}",nodeName,key,taskId,date);
|
|
|
tbClient.updateTaskCustomField(taskId,creatorId, UtilMap.map("customfieldName, value",key,Arrays.asList(new JSONObject().fluentPut("title",date))));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private String getContainsName(String name){
|
|
|
+ for (String key : NODE_FIELDNAME.keySet()) {
|
|
|
+ if(name.contains(key)){
|
|
|
+ return key;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static Map<String,String[]> NODE_FIELDNAME=new HashMap<>();
|
|
|
+ static{
|
|
|
+ NODE_FIELDNAME.put("设计接单",new String[]{"设计截止时间","设计开始时间"});
|
|
|
+ NODE_FIELDNAME.put("班线组接单",new String[]{"班线组接单截止时间","班线组接单开始时间"});
|
|
|
+ NODE_FIELDNAME.put("制作接单",new String[]{"制作截止时间","制作开始时间"});
|
|
|
+ NODE_FIELDNAME.put("打样组接单",new String[]{"打样组接单截止时间","打样组接单开始时间"});
|
|
|
+ }
|
|
|
+
|
|
|
private void nextNode(String taskId,List<Map> list,String nodeId,String creatorId){
|
|
|
Map nextMap=_getNextNode(list,nodeId);
|
|
|
if(nextMap!=null){
|