垃圾代码.txt 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. org.jeecg.modules.dataVue.task.FocusWarnJob
  2. //复杂情况
  3. private void getCassByJs(String jh, String distance,String js){
  4. BigDecimal jsNum=new BigDecimal(js);
  5. String warnHisSql="select * from (select * from A_FOCUS_WARN where JH='%s' and SOURCE='临井复杂' order by WARN_TIME desc) where rownum=1";
  6. warnHisSql=String.format(warnHisSql,jh);
  7. List<Map<String, Object>> warnHisList= iaFocusWarnService.querySql(warnHisSql,null);
  8. if(warnHisList.size()>0){
  9. BigDecimal dsjsHis=new BigDecimal(warnHisList.get(0).get("DSJS").toString());
  10. if((dsjsHis.subtract(jsNum)).compareTo(new BigDecimal("1"))==-1&&(dsjsHis.subtract(jsNum)).compareTo(new BigDecimal("-1"))==1){
  11. return;
  12. }
  13. }
  14. long startTime = System.currentTimeMillis();
  15. String sql = " select xzb x, yzb y "
  16. + " from v_scdt_jwxx t " +
  17. " where xzb is not null and yzb is not null "
  18. + String.format(" and jh = '%s' ", jh);
  19. List<Map<String, Object>> data = iLjrbService.querySql(sql, null);
  20. if (data.size() == 0) {
  21. sql = " select t2.sjjwzzbx x, t2.SJJWZZBY y from mv_azj01 t2 " +
  22. " where sjjwzzbx is not null and sjjwzzby is not null "
  23. + String.format(" and jh = '%s' ", jh);
  24. data = iZjfzService.querySql(sql, null);
  25. }
  26. String[] x = new String[2];
  27. if (data.size() > 0) {
  28. x[0] = data.get(0).get("X").toString();
  29. x[1] = data.get(0).get("Y").toString();
  30. }
  31. if (data.size() == 0) {
  32. return;
  33. }
  34. String zzbX = x[0]; // 4xxxxxx
  35. String hzbY = x[1]; // 2yyyyyyyy
  36. sql = "select t1.ID,t1.JH, SGXH, SGMC, DSJS, t3.name as caselevel, t2.sjjwzzbx, t2.sjjwhzby\n" +
  37. " from jsra t1\n" +
  38. " left join jjbxx t2\n" +
  39. " on t2.jh = t1.jh\n" +
  40. " left join Text_cl t3\n" +
  41. " on t3.id = t1.sgdjbh\n" +
  42. " where sglbid is not null\n" +
  43. " and sqrt(power((t2.sjjwzzbx - %s), 2) +\n" +
  44. " power((t2.sjjwhzby - %s), 2)) < %s\n" +
  45. " order by t1.dsjs ";
  46. sql = String.format(sql, zzbX, hzbY, distance);
  47. List<Map<String, Object>> list = iZjfzService.querySql(sql, null);
  48. List<AFocusWarn> warnList=new ArrayList<>();
  49. for(Map<String,Object> itemMap:list){
  50. BigDecimal dsjs=new BigDecimal(itemMap.get("DSJS").toString());
  51. if((dsjs.subtract(jsNum)).compareTo(new BigDecimal("1"))==-1&&(dsjs.subtract(jsNum)).compareTo(new BigDecimal("-1"))==1){
  52. AFocusWarn record=new AFocusWarn();
  53. record.setSource("邻井复杂");
  54. record.setJh(jh);
  55. record.setCatogary(itemMap.get("SGMC").toString());
  56. record.setWarnTime(new Date());
  57. record.setBjnr(itemMap.get("FSJGJYY").toString());
  58. record.setServercost(System.currentTimeMillis() - startTime);
  59. record.setDsjs(itemMap.get("DSJS").toString());
  60. record.setKey(jh+jh);
  61. warnList.add(record);
  62. }
  63. }
  64. iaFocusWarnService.saveBatch(warnList);
  65. }