1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import cn.hutool.core.io.FileUtil;
- import cn.hutool.http.HttpUtil;
- import com.alibaba.fastjson.JSONObject;
- import com.malk.poc.Boot;
- import com.malk.server.aliwork.YDConf;
- import com.malk.server.aliwork.YDParam;
- import com.malk.service.aliwork.YDClient;
- import com.malk.utils.UtilMap;
- import lombok.extern.slf4j.Slf4j;
- import org.junit.Test;
- import org.junit.runner.RunWith;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.boot.test.context.SpringBootTest;
- import org.springframework.test.context.junit4.SpringRunner;
- import java.util.List;
- /**
- * @author floe
- * @date 2024/7/22 22:29
- */
- @Slf4j
- @SpringBootTest(classes = Boot.class)
- @RunWith(SpringRunner.class)
- public class testLocal {
- @Autowired
- private YDClient ydClient;
- @Test
- public void test(){
- String token="Bearer ".concat(getToken());
- List<String> ids= FileUtil.readLines("/home/ids.txt","utf-8");
- // List<String> ids= Arrays.asList("66697d643f7c5aef23f3a326###FINST-TM966BD1ISXM7XLDC9AGM4N92MDV325WL1YYLV9B","6699cef58e173e99e22d8de4###FINST-MBC668915E4NNTTUAFIFSDQZTPYT2T3WIV0ZLBF6");
- for (int i = 0; i < ids.size(); i++) {
- String result=HttpUtil.createPost("https://apigateway.awinic.com/sys/teambition/api/aiwei/do-check?taskId="+ids.get(i).split("###")[0])
- .header("authorization",token).execute().body();
- System.out.println(result);
- JSONObject resultObj=JSONObject.parseObject(result);
- if(!resultObj.getBoolean("success")){
- continue;
- }
- JSONObject data=resultObj.getJSONObject("data");
- data.remove("tableField_lqxxgj4s");
- data.remove("userId");
- ydClient.operateData(YDParam.builder().updateFormDataJson(JSONObject.toJSONString(data)).formInstanceId(ids.get(i).split("###")[1]).build()
- , YDConf.FORM_OPERATION.update);
- }
- }
- private String getToken(){
- String a=HttpUtil.post("https://apigateway.awinic.com/token/getToken", JSONObject.toJSONString(UtilMap.map("appKey, secret","AW394034j","RJbH7RMH3vllt4KDri303Mlw@df3434k")));
- System.out.println(a);
- return JSONObject.parseObject(a).getJSONObject("data").getString("token");
- }
- }
|