package com.example.sso.newschedule; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.example.sso.newdao.DanJuAdd; import com.example.sso.newdao.HkDown; import com.example.sso.newdao.HuanKuanDanTongGuos; import com.example.sso.newdao.HuanKuanDangAdds; import com.example.sso.util.NcUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.io.IOException; @Slf4j @Component public class HuanKuanDanTongGuo { @Scheduled(fixedRate = 5000) public String hktg () throws IOException { JSONArray shenpi = HuanKuanDanTongGuos.shenpi(); for (Object o : shenpi){ JSONObject test = (JSONObject) o; String report_ncid = test.getString("report_ncid"); String still_id = test.getString("still_id"); String id = test.getString("_id"); String opinion_all = test.getString("opinion_all"); JSONObject jsonObject = new JSONObject(); jsonObject.put("billid",report_ncid); jsonObject.put("spyj",opinion_all); String jsonString = jsonObject.toJSONString(); String s = NcUtils.approveBx(jsonString); log.info("还款单通过 " +s); String balance = ""; String begindate = ""; String canusedata = ""; String ctrldata = ""; String deptname = ""; String enddate = ""; String orgname = ""; String plandata = ""; String planname = ""; String readydate = ""; String rundata = ""; String szxmname = ""; JSONObject jsonObject3 = JSON.parseObject(s); if (s.contains("ysdata")) { String code = jsonObject3.getString("code"); String msg = jsonObject3.getString("msg"); String billid = jsonObject3.getString("billid"); String ysmsg = jsonObject3.getString("ysmsg"); JSONArray jsonArray2 = jsonObject3.getJSONArray("ysdata"); for (Object object : jsonArray2) { JSONObject jsonObject4 = (JSONObject) object; balance = jsonObject4.getString("balance"); begindate = jsonObject4.getString("begindate"); canusedata = jsonObject4.getString("canusedata"); ctrldata = jsonObject4.getString("ctrldata"); deptname = jsonObject4.getString("deptname"); enddate = jsonObject4.getString("enddate"); orgname = jsonObject4.getString("orgname"); plandata = jsonObject4.getString("plandata"); planname = jsonObject4.getString("planname"); readydate = jsonObject4.getString("readydate"); rundata = jsonObject4.getString("rundata"); szxmname = jsonObject4.getString("szxmname"); DanJuAdd.insert("还款单通过", planname, begindate, enddate, orgname, deptname, szxmname, plandata, ctrldata, rundata, readydate, canusedata, balance, still_id); } HuanKuanDanTongGuos.updataalls(id, code, msg, ysmsg); HkDown.hk(id); return "okkkkk"; } else { String code = jsonObject3.getString("code"); String msg = jsonObject3.getString("msg"); HuanKuanDanTongGuos.updata(id, code, msg); return "lklklkll"; } } return "无操作"; } }