AutoQueryBoclnfosForZH_TZ.java 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package service;
  2. import com.alibaba.fastjson.JSONArray;
  3. import com.alibaba.fastjson.JSONObject;
  4. import common.ServiceController;
  5. import common.YosException;
  6. import common.data.Rows;
  7. import restcontroller.webmanage.sale.bankstatement.CreateBankstatement;
  8. import restcontroller.webmanage.sale.bankstatement.ZHUtils.BOC;
  9. import java.util.ArrayList;
  10. public class AutoQueryBoclnfosForZH_TZ extends ServiceController {
  11. @Override
  12. public void serviceRun() throws YosException {
  13. String siteid = "TZ";
  14. Rows rows = dbConnect.runSqlQuery("select count(0) sum from sa_bankstatement where datediff(now(),createdate)=0 and siteid='" + siteid + "' and banktype ='中行'");
  15. long begnum = rows.get(0).getLong("sum") + 1;
  16. if (begnum == 0) {
  17. begnum = 1;
  18. }
  19. JSONArray jsonArray = new BOC().query(siteid, (int) begnum);
  20. if (!jsonArray.isEmpty()) {
  21. JSONObject jsonObject = CreateBankstatement.createBankstatement(this, jsonArray, siteid, "中行");
  22. dbConnect.runSqlUpdate((ArrayList<String>) jsonObject.get("sqlList"));
  23. ArrayList<Long> idList = (ArrayList<Long>) jsonObject.get("idList");
  24. for (Long id : idList) {
  25. Rows statusRows = dbConnect.runSqlQuery("select status from sa_bankstatement where siteid='" + siteid + "' and sa_bankstatementid=" + id);
  26. if (statusRows.isNotEmpty() && statusRows.get(0).getString("status").equals("未入账")) {
  27. CreateBankstatement.autoRemind(this, "bankstatementerr", id, siteid);
  28. }
  29. }
  30. }
  31. }
  32. }