133 lines
4.5 KiB
Java
133 lines
4.5 KiB
Java
package com.example.sso.controller;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.example.sso.util.V5utils;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
@RestController
|
|
@Slf4j
|
|
public class LiuChengController {
|
|
// @PostMapping("/liucheng")
|
|
// public String tuisong(@RequestBody JSONObject datass) {
|
|
//
|
|
// JSONObject jsonObject = datass.getJSONObject("data");
|
|
//
|
|
// log.info(jsonObject.toJSONString());
|
|
// String is_done = jsonObject.getString("is_done");
|
|
// String re_result = jsonObject.getString("is_done_2");
|
|
// String id = jsonObject.getString("_id");
|
|
// if (!is_done.isEmpty() && !re_result.isEmpty()){
|
|
// log.info("我要推送啦 " + id);
|
|
// JSONObject jsonObject4 = new JSONObject();
|
|
// jsonObject4.put("instance_id",id);
|
|
// jsonObject4.put("tasks_type",1);
|
|
// String jsonString1 = jsonObject4.toJSONString();
|
|
//
|
|
// String selectliucheng = V5utils.selectliucheng(jsonString1);
|
|
// JSONObject jsonObject5 = JSON.parseObject(selectliucheng);
|
|
// JSONArray jsonArray1 = jsonObject5.getJSONArray("tasks");
|
|
//
|
|
// for (Object o1 : jsonArray1){
|
|
// JSONObject jsonObject6 = (JSONObject) o1;
|
|
// Integer status = jsonObject6.getInteger("status");
|
|
// String task_id = jsonObject6.getString("task_id");
|
|
// String creator = jsonObject6.getJSONObject("assignee").getString("integrate_id");
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
// if (status == 0){
|
|
// JSONObject jsonObject7 = new JSONObject();
|
|
// jsonObject7.put("username",creator);
|
|
// jsonObject7.put("instance_id",id);
|
|
// jsonObject7.put("task_id",task_id);
|
|
//
|
|
// String jsonString2 = jsonObject7.toJSONString();
|
|
//
|
|
//
|
|
// String comment = V5utils.comment(jsonString2);
|
|
// log.info(" 结果 " +comment );
|
|
//
|
|
//
|
|
// }
|
|
//
|
|
// }
|
|
//
|
|
//
|
|
// }
|
|
//
|
|
//
|
|
// return "";
|
|
// }
|
|
|
|
|
|
@PostMapping("/liucheng")
|
|
public String tuisong(@RequestBody JSONObject datass) {
|
|
|
|
JSONObject jsonObject = datass.getJSONObject("data");
|
|
|
|
log.info(jsonObject.toJSONString());
|
|
String is_done = jsonObject.getString("is_done");
|
|
String re_result = jsonObject.getString("is_done_2");
|
|
String id = jsonObject.getString("_id");
|
|
if (!is_done.isEmpty() && !re_result.isEmpty()) {
|
|
log.info("我要推送啦 " + id);
|
|
JSONObject jsonObject4 = new JSONObject();
|
|
jsonObject4.put("instance_id", id);
|
|
jsonObject4.put("tasks_type", 1);
|
|
String jsonString1 = jsonObject4.toJSONString();
|
|
|
|
log.info("擦金好像 " + jsonString1);
|
|
String selectliucheng = V5utils.selectliucheng(jsonString1);
|
|
JSONObject jsonObject5 = JSON.parseObject(selectliucheng);
|
|
JSONArray jsonArray1 = jsonObject5.getJSONArray("tasks");
|
|
log.info("数组 " + jsonArray1);
|
|
|
|
for (Object o1 : jsonArray1) {
|
|
JSONObject jsonObject6 = (JSONObject) o1;
|
|
String title = jsonObject6.getString("title");
|
|
|
|
String task_id = jsonObject6.getString("task_id");
|
|
Integer status = jsonObject6.getInteger("status");
|
|
|
|
if (title.equals("提交审查结果")) {
|
|
JSONObject object = jsonObject6.getJSONObject("assignee");
|
|
log.info("我是username " + object);
|
|
String username = object.getString("username");
|
|
if ((username.equals("YDPC09")) && (status == 0 || status == 4)) {
|
|
JSONObject jsonObject7 = new JSONObject();
|
|
jsonObject7.put("username", username);
|
|
jsonObject7.put("instance_id", id);
|
|
jsonObject7.put("task_id", task_id);
|
|
|
|
String jsonString2 = jsonObject7.toJSONString();
|
|
|
|
log.info("提交 " + jsonString2);
|
|
String comment = V5utils.comment(jsonString2);
|
|
log.info(" 结果 " + comment);
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return "";
|
|
}
|
|
}
|