|
@@ -14,6 +14,7 @@ import com.malk.service.dingtalk.DDClient;
|
|
import com.malk.utils.PublicUtil;
|
|
import com.malk.utils.PublicUtil;
|
|
import com.malk.utils.UtilHttp;
|
|
import com.malk.utils.UtilHttp;
|
|
import com.malk.utils.UtilMap;
|
|
import com.malk.utils.UtilMap;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.logging.log4j.util.Strings;
|
|
import org.apache.logging.log4j.util.Strings;
|
|
import org.slf4j.MDC;
|
|
import org.slf4j.MDC;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -22,6 +23,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
|
|
+@Slf4j
|
|
@Service
|
|
@Service
|
|
public class McYdServiceImpl implements McYdService {
|
|
public class McYdServiceImpl implements McYdService {
|
|
@Autowired
|
|
@Autowired
|
|
@@ -46,28 +48,48 @@ public class McYdServiceImpl implements McYdService {
|
|
.updateFormDataJson("{}").build(), YDConf.FORM_OPERATION.update);
|
|
.updateFormDataJson("{}").build(), YDConf.FORM_OPERATION.update);
|
|
}else if (Strings.isBlank(formInstId) && Strings.isNotBlank(formUuid)){
|
|
}else if (Strings.isBlank(formInstId) && Strings.isNotBlank(formUuid)){
|
|
int i = 1;
|
|
int i = 1;
|
|
- int pageSize = 50;
|
|
|
|
- DDR_New ddrNew;
|
|
|
|
|
|
+ int pageSize = 20;
|
|
|
|
+ DDR_New ddrNew = null;
|
|
do {
|
|
do {
|
|
- ddrNew = ydClient.queryData(YDParam.builder()
|
|
|
|
- .formUuid(formUuid)
|
|
|
|
- .pageNumber(i)
|
|
|
|
- .pageSize(pageSize)
|
|
|
|
- .build(), YDConf.FORM_QUERY.retrieve_search_form_id);
|
|
|
|
|
|
+ int i1 =1 ;
|
|
|
|
+ boolean flag1 = false;
|
|
|
|
+ while (i1<=5 && !flag1) {
|
|
|
|
+ try {
|
|
|
|
+ ddrNew = ydClient.queryData(YDParam.builder()
|
|
|
|
+ .formUuid(formUuid)
|
|
|
|
+ .pageNumber(i)
|
|
|
|
+ .pageSize(pageSize)
|
|
|
|
+ .build(), YDConf.FORM_QUERY.retrieve_search_form_id);
|
|
|
|
|
|
- List<String> formInstIdList = (List<String>) ddrNew.getData();
|
|
|
|
|
|
+ List<String> formInstIdList = (List<String>) ddrNew.getData();
|
|
|
|
|
|
- //noExecuteExpression字段不传或传false 传true会导致实例版本不更新或滞后更新
|
|
|
|
- ydClient.operateData(YDParam.builder()
|
|
|
|
- .formInstanceIdList(formInstIdList)
|
|
|
|
- .formUuid(formUuid)
|
|
|
|
- .useLatestFormSchemaVersion(true)
|
|
|
|
- .updateFormDataJson("{}")
|
|
|
|
- .noExecuteExpression(false)
|
|
|
|
- .asynchronousExecution(false)
|
|
|
|
- .build(),YDConf.FORM_OPERATION.multi_update);
|
|
|
|
|
|
+ //noExecuteExpression字段不传或传false 传true会导致实例版本不更新或滞后更新
|
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
|
+ .formInstanceIdList(formInstIdList)
|
|
|
|
+ .formUuid(formUuid)
|
|
|
|
+ .useLatestFormSchemaVersion(true)
|
|
|
|
+ .updateFormDataJson("{}")
|
|
|
|
+ .noExecuteExpression(false)
|
|
|
|
+ .asynchronousExecution(false)
|
|
|
|
+ .build(),YDConf.FORM_OPERATION.multi_update);
|
|
|
|
+
|
|
|
|
+ i++;
|
|
|
|
+ flag1 = true;
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ log.error("更新表单实例版本失败:{}, 重试次数:{}",e.getMessage(),i1);
|
|
|
|
+ try {
|
|
|
|
+ Thread.sleep(3000);
|
|
|
|
+ } catch (InterruptedException ex) {
|
|
|
|
+ throw new RuntimeException(ex);
|
|
|
|
+ }
|
|
|
|
+ i1++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (i1 > 5){
|
|
|
|
+ log.error("更新表单实例版本失败:{}");
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
|
|
- i++;
|
|
|
|
}while (ddrNew.getTotalCount() > ddrNew.getPageNumber() * pageSize);
|
|
}while (ddrNew.getTotalCount() > ddrNew.getPageNumber() * pageSize);
|
|
}
|
|
}
|
|
|
|
|