package com.example.sso.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.example.sso.dao.GongZiFaFang; import com.example.sso.dao.UpDataYes; import com.example.sso.util.GongZiUtil; 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 GongZiController { @PostMapping("/gongzi") public String gongzi(@RequestBody JSONObject driver){ log.info(driver.toJSONString()); log.info("------------------------------------------------------------"); JSONObject jsonObject = new JSONObject(); jsonObject.put("app_id", "667cc6dbaa923599ad735201"); jsonObject.put("entry_id", "62f4913c82654a00085de9e4"); jsonObject.put("limit",10000); JSONArray fields = new JSONArray(); fields.add("yuefen"); fields.add("status_jiaoyan"); fields.add("sijishenfenzhenghao"); fields.add("jine"); fields.add("yinhangkahao"); fields.add("status_yinhang"); JSONObject filter = new JSONObject(); filter.put("rel","and"); JSONArray jsonArray = new JSONArray(); JSONObject jsonObject1 = new JSONObject(); jsonObject1.put("field","status_jiaoyan"); jsonObject1.put("method","empty"); jsonArray.add(jsonObject1); filter.put("cond",jsonArray); jsonObject.put("fields",fields); jsonObject.put("filter",filter); String jsonString = jsonObject.toJSONString(); String list = V5utils.list(jsonString); JSONObject jsonObject2 = JSON.parseObject(list); JSONArray jsonArray1 = jsonObject2.getJSONArray("data"); String yuefen = GongZiUtil.yuefen(); for (Object o : jsonArray1){ JSONObject test = (JSONObject) o; String yuefen1 = test.getString("yuefen"); String sijishenfenzhenghao = test.getString("sijishenfenzhenghao"); Integer jine = test.getInteger("jine"); String yinhangkahao = test.getString("yinhangkahao"); String status_yinhang = test.getString("status_yinhang"); String id = test.getString("_id"); if (yuefen.equals(yuefen1)){ String fafang = GongZiFaFang.fafang(yuefen1, sijishenfenzhenghao, jine, yinhangkahao, status_yinhang); log.info(fafang); UpDataYes.updata(id); } } return "Success"; } }