diff --git a/mvnw.cmd b/mvnw.cmd index 84d60ab..f2811a5 100644 --- a/mvnw.cmd +++ b/mvnw.cmd @@ -50,7 +50,7 @@ if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" :skipRcPre -@setlocal +etlocal set ERROR_CODE=0 diff --git a/src/main/java/com/example/sso/schedule/GongDan.java b/src/main/java/com/example/sso/schedule/GongDan.java new file mode 100644 index 0000000..f2dd934 --- /dev/null +++ b/src/main/java/com/example/sso/schedule/GongDan.java @@ -0,0 +1,602 @@ +package com.example.sso.schedule; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.example.sso.util.RongLianQiMo; +import com.example.sso.util.TimeUtil; +import com.example.sso.util.V5utils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import javax.jws.soap.SOAPBinding; +import java.time.LocalDate; +import java.time.temporal.TemporalAdjusters; +import java.util.*; + +@Slf4j +@Component +public class GongDan { + //写入基础表 + public static void main1(String[] args) { + + int page = 1; + + + Boolean flag = true; + while (flag) { + + //查询工单 + JSONObject jsonObject = new JSONObject(); + jsonObject.put("beginCreateTime", "2026-01-01 00:00:00"); + jsonObject.put("endCreateTime", "2026-01-01 23:59:59"); + + if (page != 1) { + jsonObject.put("page", page); + jsonObject.put("pageSize", 200); + } + + String s = jsonObject.toJSONString(); + String gongdan = RongLianQiMo.gongdan(s); + JSONObject jsonObject1 = JSON.parseObject(gongdan); + JSONArray data = jsonObject1.getJSONArray("data"); + int size = data.size(); + + + if (size == 200) { + + for (Object o : data) { + JSONObject test = (JSONObject) o; + String flowName = test.getString("flowName"); + String status = test.getString("status"); + + JSONObject object = new JSONObject(); + object.put("app_id", "68215c6cbaccd58c66796bc5"); + object.put("entry_id", "69a94e774997401c0ba917d3"); + JSONObject data1 = new JSONObject(); + + JSONObject xm = new JSONObject(); + xm.put("value", flowName); + data1.put("flowname", xm); + + JSONObject xm2 = new JSONObject(); + xm2.put("value", status); + data1.put("status", xm2); + + object.put("data", data1); + String s1 = object.toJSONString(); + V5utils.add(s1); + + + } + + + page += 1; + + } else { + + for (Object o : data) { + JSONObject test = (JSONObject) o; + String flowName = test.getString("flowName"); + String status = test.getString("status"); + + JSONObject object = new JSONObject(); + object.put("app_id", "68215c6cbaccd58c66796bc5"); + object.put("entry_id", "69a94e774997401c0ba917d3"); + JSONObject data1 = new JSONObject(); + + JSONObject xm = new JSONObject(); + xm.put("value", flowName); + data1.put("flowname", xm); + + JSONObject xm2 = new JSONObject(); + xm2.put("value", status); + data1.put("status", xm2); + + object.put("data", data1); + String s1 = object.toJSONString(); + V5utils.add(s1); + + } + flag = false; + + } + + } + + + } + + //计算工单 + public static void main(String[] args) { + String data_id = ""; + Boolean flag = true; + List list = new ArrayList(); + JSONArray jsonArray = new JSONArray(); + while (flag) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("app_id", "68215c6cbaccd58c66796bc5"); + jsonObject.put("entry_id", "69a94e774997401c0ba917d3"); + jsonObject.put("limit", 10000); + if (!data_id.equals("")) { + jsonObject.put("data_id", "data_id"); + } + String s = jsonObject.toJSONString(); + String list1 = V5utils.list(s); + JSONObject jsonObject1 = JSON.parseObject(list1); + JSONArray data = jsonObject1.getJSONArray("data"); + int size = data.size(); + if (size == 10000) { + + for (Object o : data) { + JSONObject test = (JSONObject) o; + String string = test.getString("flowname"); + String id = test.getString("_id"); + list.add(string); + jsonArray.add(test); + data_id = id; + + } + + } else { + for (Object o : data) { + JSONObject test = (JSONObject) o; + String string = test.getString("flowname"); + String id = test.getString("_id"); + list.add(string); + jsonArray.add(test); + } + flag = false; + + + } + + } + + String yue = TimeUtil.yue(); + + + + GongDan.del(); + JSONObject object = new JSONObject(); + object.put("app_id", "68215c6cbaccd58c66796bc5"); + object.put("entry_id", "69a9202ba45f194180c8617c"); + JSONObject data1 = new JSONObject(); + + JSONObject xm = new JSONObject(); + xm.put("value", yue); + data1.put("q", xm); + + JSONObject xm2 = new JSONObject(); + xm2.put("value", String.valueOf(list.size())); + data1.put("w", xm2); + + JSONObject xm3 = new JSONObject(); + xm3.put("value", String.valueOf(GongDan.selectconts("complete"))); + data1.put("e", xm3); + + double result = (double)GongDan.selectconts("complete")/list.size(); + String formatted = String.format("%.2f", result); + + JSONObject xm4 = new JSONObject(); + xm4.put("value", formatted); + data1.put("r", xm4); + + JSONObject xm5 = new JSONObject(); + xm5.put("value", "/"); + data1.put("t", xm5); + + JSONObject xm6 = new JSONObject(); + xm6.put("value", "/"); + data1.put("y", xm6); + + JSONObject xm7 = new JSONObject(); + xm7.put("value", "/"); + data1.put("u", xm7); + + + + + + object.put("data", data1); + String s1 = object.toJSONString(); + V5utils.add(s1); + + + + + + + + + + + + + log.info("我是数量 " + list.size()); + Set set = new HashSet<>(list); + List list1 = new ArrayList<>(set); + + + for (int i = 0; i < list1.size(); i++) { + String s = list1.get(i); + log.info("去重 " + s); + + int selectcont = GongDan.selectcont(s); + int complete = GongDan.selectcontstatus(s, "complete"); + + double result1 = (double) complete / selectcont; + + String formatted1 = String.format("%.2f", result1); + + + JSONObject object1 = new JSONObject(); + object1.put("app_id", "68215c6cbaccd58c66796bc5"); + object1.put("entry_id", "69a9202ba45f194180c8617c"); + JSONObject data11 = new JSONObject(); + + JSONObject xm11 = new JSONObject(); + xm11.put("value", yue); + data11.put("q", xm11); + + JSONObject xm112 = new JSONObject(); + xm112.put("value", selectcont); + data11.put("t", xm112); + + JSONObject xm113 = new JSONObject(); + xm113.put("value", complete); + data11.put("y", xm113); + + JSONObject xm114 = new JSONObject(); + xm114.put("value", formatted1); + data11.put("u", xm114); + + JSONObject xm115 = new JSONObject(); + xm115.put("value", s); + data11.put("w", xm115); + + + + JSONObject xm117 = new JSONObject(); + xm117.put("value", "/"); + data11.put("e", xm117); + + JSONObject xm118 = new JSONObject(); + xm118.put("value", "/"); + data11.put("r", xm118); + + object1.put("data", data11); + String s11 = object1.toJSONString(); + V5utils.add(s11); + + + + + + } + + + } + + + //各类数量 + public static int selectcont(String a) { + + Boolean flag = true; + String data_id = ""; + List list = new ArrayList(); + + while (flag) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("app_id", "68215c6cbaccd58c66796bc5"); + jsonObject.put("entry_id", "69a94e774997401c0ba917d3"); + jsonObject.put("limit", 10000); + + JSONObject filter = new JSONObject(); + filter.put("rel", "and"); + JSONArray cond = new JSONArray(); + JSONObject jsonObject1 = new JSONObject(); + jsonObject1.put("field", "flowname"); + jsonObject1.put("method", "eq"); + JSONArray value = new JSONArray(); + value.add(a); + jsonObject1.put("value", value); + cond.add(jsonObject1); + filter.put("cond", cond); + jsonObject.put("filter", filter); + + + if (!data_id.equals("")) { + jsonObject.put("data_id", "data_id"); + } + String s = jsonObject.toJSONString(); + String list1 = V5utils.list(s); + JSONObject jsonObject2 = JSON.parseObject(list1); + JSONArray data = jsonObject2.getJSONArray("data"); + int size = data.size(); + if (size == 10000) { + + for (Object o : data) { + JSONObject test = (JSONObject) o; + + String id = test.getString("_id"); + list.add(id); + + data_id = id; + + } + + } else { + for (Object o : data) { + JSONObject test = (JSONObject) o; + + String id = test.getString("_id"); + list.add(id); + + } + flag = false; + + + } + + } + + int size = list.size(); + + return size; + } + + //各类完成两 + public static int selectcontstatus(String cont, String sta) { + + Boolean flag = true; + String data_id = ""; + List list = new ArrayList(); + + while (flag) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("app_id", "68215c6cbaccd58c66796bc5"); + jsonObject.put("entry_id", "69a94e774997401c0ba917d3"); + jsonObject.put("limit", 10000); + + JSONObject filter = new JSONObject(); + filter.put("rel", "and"); + JSONArray cond = new JSONArray(); + + JSONObject jsonObject1 = new JSONObject(); + jsonObject1.put("field", "flowname"); + jsonObject1.put("method", "eq"); + JSONArray value = new JSONArray(); + value.add(cont); + jsonObject1.put("value", value); + + + JSONObject jsonObject3 = new JSONObject(); + jsonObject3.put("field", "status"); + jsonObject3.put("method", "eq"); + JSONArray value1 = new JSONArray(); + value1.add(sta); + jsonObject3.put("value", value1); + + + cond.add(jsonObject1); + cond.add(jsonObject3); + filter.put("cond", cond); + jsonObject.put("filter", filter); + + + if (!data_id.equals("")) { + jsonObject.put("data_id", "data_id"); + } + String s = jsonObject.toJSONString(); + String list1 = V5utils.list(s); + JSONObject jsonObject2 = JSON.parseObject(list1); + JSONArray data = jsonObject2.getJSONArray("data"); + int size = data.size(); + if (size == 10000) { + + for (Object o : data) { + JSONObject test = (JSONObject) o; + + String id = test.getString("_id"); + list.add(id); + + data_id = id; + + } + + } else { + for (Object o : data) { + JSONObject test = (JSONObject) o; + + String id = test.getString("_id"); + list.add(id); + + } + flag = false; + + + } + + } + + int size = list.size(); + + return size; + } + + //删除本月数据 + public static void del() { + + Boolean flag = true; + String id = ""; + List lists = new ArrayList<>(); + while (flag){ + + JSONObject jsonObject = new JSONObject(); + jsonObject.put("app_id","68215c6cbaccd58c66796bc5"); + jsonObject.put("entry_id","69a9202ba45f194180c8617c"); + jsonObject.put("limit",10000); + + JSONObject filter = new JSONObject(); + filter.put("rel", "and"); + JSONArray cond = new JSONArray(); + JSONObject jsonObject1 = new JSONObject(); + jsonObject1.put("field", "q"); + jsonObject1.put("method", "eq"); + JSONArray value = new JSONArray(); + value.add(TimeUtil.yue()); + jsonObject1.put("value", value); + cond.add(jsonObject1); + filter.put("cond", cond); + jsonObject.put("filter", filter); + if (!id.equals("")){ + jsonObject.put("data_id",id); + } + + String jsonString = jsonObject.toJSONString(); + String list = V5utils.list(jsonString); + JSONObject jsonObject3 = JSON.parseObject(list); + JSONArray data = jsonObject3.getJSONArray("data"); + + + + int size = data.size(); + log.info("我是长度 " + size); + + + if (size < 10000 ) { + for (Object o : data) { + JSONObject test = (JSONObject) o; + String string = test.getString("_id"); + lists.add(string); + if (lists.size() == 100) { + JSONObject jsonObject2 = new JSONObject(); + jsonObject2.put("app_id", "68215c6cbaccd58c66796bc5"); + jsonObject2.put("entry_id", "69a9202ba45f194180c8617c"); + jsonObject2.put("data_ids", lists); + String jsonString1 = jsonObject2.toJSONString(); + log.info("我是删除参数 " + jsonString1); + V5utils.deletes(jsonString1); + lists.clear(); + } + } + + + + flag = false; + + }else { + for (Object o : data) { + JSONObject test = (JSONObject) o; + String string = test.getString("_id"); + lists.add(string); + id = string; + if (lists.size() == 100) { + JSONObject jsonObject2 = new JSONObject(); + jsonObject2.put("app_id", "68215c6cbaccd58c66796bc5"); + jsonObject2.put("entry_id", "69a9202ba45f194180c8617c"); + jsonObject2.put("data_ids", lists); + String jsonString1 = jsonObject2.toJSONString(); + log.info("我是删除参数 " + jsonString1); + V5utils.deletes(jsonString1); + lists.clear(); + } + } + + + + + + + } + + + + } + + JSONObject jsonObject2 = new JSONObject(); + jsonObject2.put("app_id", "68215c6cbaccd58c66796bc5"); + jsonObject2.put("entry_id", "69a9202ba45f194180c8617c"); + jsonObject2.put("data_ids", lists); + String jsonString1 = jsonObject2.toJSONString(); + log.info("我是删除参数 " + jsonString1); + V5utils.deletes(jsonString1); + lists.clear(); + + + + + } + + + //总量完成两 + public static int selectconts(String a) { + + Boolean flag = true; + String data_id = ""; + List list = new ArrayList(); + + while (flag) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("app_id", "68215c6cbaccd58c66796bc5"); + jsonObject.put("entry_id", "69a94e774997401c0ba917d3"); + jsonObject.put("limit", 10000); + + JSONObject filter = new JSONObject(); + filter.put("rel", "and"); + JSONArray cond = new JSONArray(); + JSONObject jsonObject1 = new JSONObject(); + jsonObject1.put("field", "status"); + jsonObject1.put("method", "eq"); + JSONArray value = new JSONArray(); + value.add(a); + jsonObject1.put("value", value); + cond.add(jsonObject1); + filter.put("cond", cond); + jsonObject.put("filter", filter); + + + if (!data_id.equals("")) { + jsonObject.put("data_id", "data_id"); + } + String s = jsonObject.toJSONString(); + String list1 = V5utils.list(s); + JSONObject jsonObject2 = JSON.parseObject(list1); + JSONArray data = jsonObject2.getJSONArray("data"); + int size = data.size(); + if (size == 10000) { + + for (Object o : data) { + JSONObject test = (JSONObject) o; + + String id = test.getString("_id"); + list.add(id); + + data_id = id; + + } + + } else { + for (Object o : data) { + JSONObject test = (JSONObject) o; + + String id = test.getString("_id"); + list.add(id); + + } + flag = false; + + + } + + } + + int size = list.size(); + + return size; + } + + +} diff --git a/src/main/java/com/example/sso/schedule/TongHua.java b/src/main/java/com/example/sso/schedule/TongHua.java new file mode 100644 index 0000000..3707dfb --- /dev/null +++ b/src/main/java/com/example/sso/schedule/TongHua.java @@ -0,0 +1,254 @@ +package com.example.sso.schedule; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.example.sso.util.RongLianQiMo; +import com.example.sso.util.V5utils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +@Component +public class TongHua { + //写入基础表 + public static void main1(String[] args) { + + int page = 1; + + + Boolean flag = true; + while (flag) { + + //查询工单 + JSONObject jsonObject = new JSONObject(); + jsonObject.put("beginTime", "2026-02-01 00:00:00"); + jsonObject.put("endTime", "2026-02-07 23:59:59"); + jsonObject.put("getAll",true); + + if (page != 1) { + jsonObject.put("page", page); + jsonObject.put("pageSize", 200); + } + + String s = jsonObject.toJSONString(); + String gongdan = RongLianQiMo.tonghua(s); + JSONObject jsonObject1 = JSON.parseObject(gongdan); + JSONArray data = jsonObject1.getJSONArray("data"); + int size = data.size(); + + + if (size == 10000) { + + for (Object o : data) { + JSONObject test = (JSONObject) o; + String CALLED_NO = test.getString("CALLED_NO"); + String STATUS = test.getString("STATUS"); + String INVESTIGATE = test.getString("INVESTIGATE"); + + JSONObject object = new JSONObject(); + object.put("app_id", "68215c6cbaccd58c66796bc5"); + object.put("entry_id", "69a94db82b2ce8cf41bc4f94"); + JSONObject data1 = new JSONObject(); + + JSONObject xm = new JSONObject(); + xm.put("value", CALLED_NO); + data1.put("calledno", xm); + + JSONObject xm2 = new JSONObject(); + xm2.put("value", STATUS); + data1.put("status", xm2); + + JSONObject xm3 = new JSONObject(); + xm3.put("value", INVESTIGATE); + data1.put("investigate", xm3); + + object.put("data", data1); + String s1 = object.toJSONString(); + V5utils.add(s1); + + + } + + + page += 1; + + } else { + + for (Object o : data) { + JSONObject test = (JSONObject) o; + String CALLED_NO = test.getString("CALLED_NO"); + String STATUS = test.getString("STATUS"); + String INVESTIGATE = test.getString("INVESTIGATE"); + + JSONObject object = new JSONObject(); + object.put("app_id", "68215c6cbaccd58c66796bc5"); + object.put("entry_id", "69a94db82b2ce8cf41bc4f94"); + JSONObject data1 = new JSONObject(); + + JSONObject xm = new JSONObject(); + xm.put("value", CALLED_NO); + data1.put("calledno", xm); + + JSONObject xm2 = new JSONObject(); + xm2.put("value", STATUS); + data1.put("status", xm2); + + JSONObject xm3 = new JSONObject(); + xm3.put("value", INVESTIGATE); + data1.put("investigate", xm3); + + object.put("data", data1); + String s1 = object.toJSONString(); + V5utils.add(s1); + + } + flag = false; + + } + + } + + + } + + //ai接听 + public static void main(String[] args) { + + String data_id = ""; + Boolean flag = true; + List list = new ArrayList(); + JSONArray jsonArray = new JSONArray(); + while (flag) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("app_id", "68215c6cbaccd58c66796bc5"); + jsonObject.put("entry_id", "69a94db82b2ce8cf41bc4f94"); + jsonObject.put("limit", 10000); + JSONObject filter = new JSONObject(); + filter.put("rel", "and"); + JSONArray cond = new JSONArray(); + JSONObject jsonObject1 = new JSONObject(); + jsonObject1.put("field", "calledno"); + jsonObject1.put("method", "eq"); + JSONArray value = new JSONArray(); + value.add("0101119181"); + jsonObject1.put("value", value); + cond.add(jsonObject1); + filter.put("cond", cond); + jsonObject.put("filter", filter); + + if (!data_id.equals("")) { + jsonObject.put("data_id", "data_id"); + } + String s = jsonObject.toJSONString(); + String list1 = V5utils.list(s); + JSONObject jsonObject2 = JSON.parseObject(list1); + JSONArray data = jsonObject2.getJSONArray("data"); + int size = data.size(); + if (size == 10000) { + + for (Object o : data) { + JSONObject test = (JSONObject) o; + String string = test.getString("flowname"); + String id = test.getString("_id"); + list.add(string); + jsonArray.add(test); + data_id = id; + + } + + } else { + for (Object o : data) { + JSONObject test = (JSONObject) o; + String string = test.getString("flowname"); + String id = test.getString("_id"); + list.add(string); + jsonArray.add(test); + } + flag = false; + + + } + + } + + log.info("数量 " + list.size()); + + + + } + + + + + //ai + public static int aideal(String a) { + + Boolean flag = true; + String data_id = ""; + List list = new ArrayList(); + + while (flag) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("app_id", "68215c6cbaccd58c66796bc5"); + jsonObject.put("entry_id", "69a94db82b2ce8cf41bc4f94"); + jsonObject.put("limit", 10000); + + JSONObject filter = new JSONObject(); + filter.put("rel", "and"); + JSONArray cond = new JSONArray(); + JSONObject jsonObject1 = new JSONObject(); + jsonObject1.put("field", "status"); + jsonObject1.put("method", "eq"); + JSONArray value = new JSONArray(); + value.add("dealing"); + jsonObject1.put("value", value); + cond.add(jsonObject1); + filter.put("cond", cond); + jsonObject.put("filter", filter); + + + if (!data_id.equals("")) { + jsonObject.put("data_id", "data_id"); + } + String s = jsonObject.toJSONString(); + String list1 = V5utils.list(s); + JSONObject jsonObject2 = JSON.parseObject(list1); + JSONArray data = jsonObject2.getJSONArray("data"); + int size = data.size(); + if (size == 10000) { + + for (Object o : data) { + JSONObject test = (JSONObject) o; + + String id = test.getString("_id"); + list.add(id); + + data_id = id; + + } + + } else { + for (Object o : data) { + JSONObject test = (JSONObject) o; + + String id = test.getString("_id"); + list.add(id); + + } + flag = false; + + + } + + } + + int size = list.size(); + + return size; + } + +} diff --git a/src/main/java/com/example/sso/test/C.java b/src/main/java/com/example/sso/test/C.java index 6741850..56b5ae1 100644 --- a/src/main/java/com/example/sso/test/C.java +++ b/src/main/java/com/example/sso/test/C.java @@ -2,29 +2,28 @@ package com.example.sso.test; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.example.sso.schedule.GongDan; import com.example.sso.util.RongLianQiMo; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; public class C { - public static void main(String[] args) throws JsonProcessingException { - ObjectMapper mapper = new ObjectMapper(); - JSONObject jsonObject = new JSONObject(); - jsonObject.put("taskid","17470385196307854951"); - JSONArray vars = new JSONArray(); - JSONObject jsonObject1 = new JSONObject(); - jsonObject1.put("phone","13675025333"); - jsonObject1.put("name","大撒红唇"); - String s = mapper.writeValueAsString(jsonObject1); - vars.add(s); - jsonObject.put("vars",vars); - jsonObject.put("count",1); - String jsonString = jsonObject.toJSONString(); - System.out.println("我是参数 " +jsonString ); - String songhao = RongLianQiMo.songhao(jsonString); - System.out.println(songhao); + public static void main(String[] args) { +// int selectcont = GongDan.selectcont("直投诉"); +// int z = GongDan.selectcontstatus("直投诉","complete"); +// double result1 = (double)z/selectcont; +// System.out.println(result1); +// String formatted1 = String.format("%.2f", result1); +// System.out.println("保留两位小数: " + formatted1); +// String getmonth = GongDan.getmonth("2026-03"); +// System.out.println(getmonth); + +// int complete = GongDan.selectconts("complete"); +// System.out.println(complete); + + GongDan.del(); } } diff --git a/src/main/java/com/example/sso/test/D.java b/src/main/java/com/example/sso/test/D.java new file mode 100644 index 0000000..76e1b15 --- /dev/null +++ b/src/main/java/com/example/sso/test/D.java @@ -0,0 +1,18 @@ +package com.example.sso.test; + +import com.alibaba.fastjson.JSONObject; +import com.example.sso.util.TimeUtil; + +import javax.jws.soap.SOAPBinding; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +public class D { + public static void main(String[] args) { + String s = TimeUtil.lastdaytime0(); + String s1 = TimeUtil.lastdaytime23(); + System.out.println(s); + System.out.println(s1); + } +} diff --git a/src/main/java/com/example/sso/test/E.java b/src/main/java/com/example/sso/test/E.java new file mode 100644 index 0000000..9411437 --- /dev/null +++ b/src/main/java/com/example/sso/test/E.java @@ -0,0 +1,19 @@ +package com.example.sso.test; + +import com.alibaba.fastjson.JSONObject; +import com.example.sso.util.RongLianQiMo; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class E { + public static void main(String[] args) { + //查询工单 + JSONObject jsonObject = new JSONObject(); + jsonObject.put("beginCreateTime","2026-01-01 00:00:00"); + jsonObject.put("endCreateTime","2026-01-01 23:59:59"); + String s = jsonObject.toJSONString(); + String gongdan = RongLianQiMo.gongdan(s); + log.info("工单数据 " +gongdan ); + + } +} diff --git a/src/main/java/com/example/sso/test/F.java b/src/main/java/com/example/sso/test/F.java new file mode 100644 index 0000000..b51fe65 --- /dev/null +++ b/src/main/java/com/example/sso/test/F.java @@ -0,0 +1,21 @@ +package com.example.sso.test; + +import com.alibaba.fastjson.JSONObject; +import com.example.sso.util.RongLianQiMo; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class F { + public static void main(String[] args) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("beginTime","2026-02-01 00:00:00"); + jsonObject.put("endTime","2026-02-07 23:59:59"); + jsonObject.put("getAll",true); + + String s = jsonObject.toJSONString(); + String gongdan = RongLianQiMo.tonghua(s); + log.info("我是数据 " +gongdan ); + + + } +} diff --git a/src/main/java/com/example/sso/test/G.java b/src/main/java/com/example/sso/test/G.java new file mode 100644 index 0000000..c60bbf5 --- /dev/null +++ b/src/main/java/com/example/sso/test/G.java @@ -0,0 +1,22 @@ +package com.example.sso.test; + +import com.alibaba.fastjson.JSONObject; +import com.example.sso.util.RongLianQiMo; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class G { + public static void main(String[] args) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("reportType","call_report_agent"); + jsonObject.put("yearReport","2026"); + jsonObject.put("monthReport","03"); + jsonObject.put("timeType","month"); + + String s = jsonObject.toJSONString(); + String gongdan = RongLianQiMo.baobiao(s); + log.info("我是数据 " +gongdan ); + + + } +} diff --git a/src/main/java/com/example/sso/util/RongLianQiMo.java b/src/main/java/com/example/sso/util/RongLianQiMo.java index dd41658..a18c507 100644 --- a/src/main/java/com/example/sso/util/RongLianQiMo.java +++ b/src/main/java/com/example/sso/util/RongLianQiMo.java @@ -82,6 +82,174 @@ public class RongLianQiMo { return responseBody; } + + + public static String gongdan(String jsonBody) { + CloseableHttpClient httpClient = HttpClients.createDefault(); + String times = TimeUtil.times(); + String APPID = "T00000032153"; + String APPTOKEN = "0692bd20-2f04-11f0-a854-bda7cd404a65"; + String AUTH = APPID + ":" + times; + String encoded = Base64.getEncoder().encodeToString(AUTH.getBytes()); + log.info("BASE64 " + encoded); + String MD5 = APPID + APPTOKEN + times; + + String mded5UpperCase32 = md5UpperCase32(MD5); + log.info("md5 " + mded5UpperCase32); + + // 创建 POST 请求对象 + HttpPost httpPost = new HttpPost("https://openapis.7moor.com/v20170704/business/getBusinessDetail/T00000032153?sig=" + mded5UpperCase32); + + String responseBody = null; + try { + // 设置请求头 + httpPost.setHeader("Content-Type", "application/json;charset=utf-8;"); + httpPost.setHeader("Authorization",encoded ); + + + + + StringEntity entity = new StringEntity(jsonBody, ContentType.APPLICATION_JSON); + httpPost.setEntity(entity); + + // 执行请求,获取响应对象 + CloseableHttpResponse response = httpClient.execute(httpPost); + + try { + // 从响应对象中获取响应实体 + HttpEntity responseEntity = response.getEntity(); + + // 处理响应数据 + responseBody = EntityUtils.toString(responseEntity); + System.out.println(responseBody); + } finally { + // 关闭响应对象 + response.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + // 关闭 HttpClient + httpClient.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + return responseBody; + } + + public static String baobiao(String jsonBody) { + CloseableHttpClient httpClient = HttpClients.createDefault(); + String times = TimeUtil.times(); + String APPID = "T00000032153"; + String APPTOKEN = "0692bd20-2f04-11f0-a854-bda7cd404a65"; + String AUTH = APPID + ":" + times; + String encoded = Base64.getEncoder().encodeToString(AUTH.getBytes()); + log.info("BASE64 " + encoded); + String MD5 = APPID + APPTOKEN + times; + + String mded5UpperCase32 = md5UpperCase32(MD5); + log.info("md5 " + mded5UpperCase32); + + // 创建 POST 请求对象 + HttpPost httpPost = new HttpPost("https://openapis.7moor.com/v20180426/report/getReportData/T00000032153?sig=" + mded5UpperCase32); + + String responseBody = null; + try { + // 设置请求头 + httpPost.setHeader("Content-Type", "application/json;charset=utf-8;"); + httpPost.setHeader("Authorization",encoded ); + + + + + StringEntity entity = new StringEntity(jsonBody, ContentType.APPLICATION_JSON); + httpPost.setEntity(entity); + + // 执行请求,获取响应对象 + CloseableHttpResponse response = httpClient.execute(httpPost); + + try { + // 从响应对象中获取响应实体 + HttpEntity responseEntity = response.getEntity(); + + // 处理响应数据 + responseBody = EntityUtils.toString(responseEntity); + System.out.println(responseBody); + } finally { + // 关闭响应对象 + response.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + // 关闭 HttpClient + httpClient.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + return responseBody; + } + + public static String tonghua(String jsonBody) { + CloseableHttpClient httpClient = HttpClients.createDefault(); + String times = TimeUtil.times(); + String APPID = "T00000032153"; + String APPTOKEN = "0692bd20-2f04-11f0-a854-bda7cd404a65"; + String AUTH = APPID + ":" + times; + String encoded = Base64.getEncoder().encodeToString(AUTH.getBytes()); + log.info("BASE64 " + encoded); + String MD5 = APPID + APPTOKEN + times; + + String mded5UpperCase32 = md5UpperCase32(MD5); + log.info("md5 " + mded5UpperCase32); + + // 创建 POST 请求对象 + HttpPost httpPost = new HttpPost("https://openapis.7moor.com/v20180426/cdr/getCCCdr/T00000032153?sig=" + mded5UpperCase32); + + String responseBody = null; + try { + // 设置请求头 + httpPost.setHeader("Content-Type", "application/json;charset=utf-8;"); + httpPost.setHeader("Authorization",encoded ); + + + + + StringEntity entity = new StringEntity(jsonBody, ContentType.APPLICATION_JSON); + httpPost.setEntity(entity); + + // 执行请求,获取响应对象 + CloseableHttpResponse response = httpClient.execute(httpPost); + + try { + // 从响应对象中获取响应实体 + HttpEntity responseEntity = response.getEntity(); + + // 处理响应数据 + responseBody = EntityUtils.toString(responseEntity); + System.out.println(responseBody); + } finally { + // 关闭响应对象 + response.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + // 关闭 HttpClient + httpClient.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + return responseBody; + } + + public static String md5UpperCase32(String input) { try { MessageDigest md = MessageDigest.getInstance("MD5"); diff --git a/src/main/java/com/example/sso/util/TimeUtil.java b/src/main/java/com/example/sso/util/TimeUtil.java index cdebbc8..481ef0a 100644 --- a/src/main/java/com/example/sso/util/TimeUtil.java +++ b/src/main/java/com/example/sso/util/TimeUtil.java @@ -42,23 +42,23 @@ public class TimeUtil { } public static String yue(){ - LocalDateTime currentDateTime = LocalDateTime.now(); // 获取当前日期和时间 - - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); - String formattedDateTime = currentDateTime.format(formatter); // 格式化当前日期和时间 - String substring = formattedDateTime.substring(0, 7); - return substring; + Calendar calendar = Calendar.getInstance(); + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM"); + String currentMonth2 = sdf2.format(calendar.getTime()); + System.out.println("Calendar获取: " + currentMonth2); + return currentMonth2; } public static String yue1(){ - // 获取当前日期 - LocalDate currentDate = LocalDate.now(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); + Calendar calendar = Calendar.getInstance(); - // 定义日期格式 - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); - // 格式化日期 - String formattedDate = currentDate.format(formatter); - return formattedDate; + + // 获取下一个月 + calendar.add(Calendar.MONTH, 1); + String nextMonth = sdf.format(calendar.getTime()); + System.out.println("下一个月: " + nextMonth); + return nextMonth; } /** @@ -282,4 +282,55 @@ public class TimeUtil { + + + + public static String lastdaytime23() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Calendar calendar = Calendar.getInstance(); + + // 获取昨天 + calendar.add(Calendar.DAY_OF_MONTH, -1); + + // 设置为23点59分59秒999毫秒 + calendar.set(Calendar.HOUR_OF_DAY, 23); + calendar.set(Calendar.MINUTE, 59); + calendar.set(Calendar.SECOND, 59); + calendar.set(Calendar.MILLISECOND, 999); + + Date yesterdayEnd = calendar.getTime(); + String formatted = sdf.format(yesterdayEnd); + + System.out.println("昨天23点59分59秒: " + formatted); + return formatted; + } + + + public static String lastdaytime0() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Calendar calendar = Calendar.getInstance(); + + // 获取昨天 + calendar.add(Calendar.DAY_OF_MONTH, -1); + + // 设置为23点59分59秒999毫秒 + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 999); + + Date yesterdayEnd = calendar.getTime(); + String formatted = sdf.format(yesterdayEnd); + + System.out.println("昨天23点59分59秒: " + formatted); + return formatted; + + } + + + + + + + } diff --git a/src/main/java/com/example/sso/util/V5utils.java b/src/main/java/com/example/sso/util/V5utils.java index 4aa328f..93a701f 100644 --- a/src/main/java/com/example/sso/util/V5utils.java +++ b/src/main/java/com/example/sso/util/V5utils.java @@ -287,6 +287,49 @@ public class V5utils { httpPost.setHeader("Authorization", "Bearer " + "BkIyzlh1onqnqu9cQ3ralDQBjECn97ex"); + StringEntity entity = new StringEntity(jsonBody, ContentType.APPLICATION_JSON); + httpPost.setEntity(entity); + + // 执行请求,获取响应对象 + CloseableHttpResponse response = httpClient.execute(httpPost); + + try { + // 从响应对象中获取响应实体 + HttpEntity responseEntity = response.getEntity(); + + // 处理响应数据 + responseBody = EntityUtils.toString(responseEntity); + System.out.println(responseBody); + } finally { + // 关闭响应对象 + response.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + // 关闭 HttpClient + httpClient.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + return responseBody; + } + + public static String deletes(String jsonBody){ + CloseableHttpClient httpClient = HttpClients.createDefault(); + + // 创建 POST 请求对象 + HttpPost httpPost = new HttpPost("https://www.jiyuankeshang.com/api/v5/app/entry/data/batch_delete"); + + String responseBody = null; + try { + // 设置请求头 + httpPost.setHeader("Content-Type", "application/json"); + httpPost.setHeader("Authorization", "Bearer " + "BkIyzlh1onqnqu9cQ3ralDQBjECn97ex"); + + StringEntity entity = new StringEntity(jsonBody, ContentType.APPLICATION_JSON); httpPost.setEntity(entity);