12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- org.jeecg.modules.dataVue.task.FocusWarnJob
- //复杂情况
- private void getCassByJs(String jh, String distance,String js){
- BigDecimal jsNum=new BigDecimal(js);
- String warnHisSql="select * from (select * from A_FOCUS_WARN where JH='%s' and SOURCE='临井复杂' order by WARN_TIME desc) where rownum=1";
- warnHisSql=String.format(warnHisSql,jh);
- List<Map<String, Object>> warnHisList= iaFocusWarnService.querySql(warnHisSql,null);
- if(warnHisList.size()>0){
- BigDecimal dsjsHis=new BigDecimal(warnHisList.get(0).get("DSJS").toString());
- if((dsjsHis.subtract(jsNum)).compareTo(new BigDecimal("1"))==-1&&(dsjsHis.subtract(jsNum)).compareTo(new BigDecimal("-1"))==1){
- return;
- }
- }
- long startTime = System.currentTimeMillis();
- String sql = " select xzb x, yzb y "
- + " from v_scdt_jwxx t " +
- " where xzb is not null and yzb is not null "
- + String.format(" and jh = '%s' ", jh);
- List<Map<String, Object>> data = iLjrbService.querySql(sql, null);
- if (data.size() == 0) {
- sql = " select t2.sjjwzzbx x, t2.SJJWZZBY y from mv_azj01 t2 " +
- " where sjjwzzbx is not null and sjjwzzby is not null "
- + String.format(" and jh = '%s' ", jh);
- data = iZjfzService.querySql(sql, null);
- }
- String[] x = new String[2];
- if (data.size() > 0) {
- x[0] = data.get(0).get("X").toString();
- x[1] = data.get(0).get("Y").toString();
- }
- if (data.size() == 0) {
- return;
- }
- String zzbX = x[0]; // 4xxxxxx
- String hzbY = x[1]; // 2yyyyyyyy
- sql = "select t1.ID,t1.JH, SGXH, SGMC, DSJS, t3.name as caselevel, t2.sjjwzzbx, t2.sjjwhzby\n" +
- " from jsra t1\n" +
- " left join jjbxx t2\n" +
- " on t2.jh = t1.jh\n" +
- " left join Text_cl t3\n" +
- " on t3.id = t1.sgdjbh\n" +
- " where sglbid is not null\n" +
- " and sqrt(power((t2.sjjwzzbx - %s), 2) +\n" +
- " power((t2.sjjwhzby - %s), 2)) < %s\n" +
- " order by t1.dsjs ";
- sql = String.format(sql, zzbX, hzbY, distance);
- List<Map<String, Object>> list = iZjfzService.querySql(sql, null);
- List<AFocusWarn> warnList=new ArrayList<>();
- for(Map<String,Object> itemMap:list){
- BigDecimal dsjs=new BigDecimal(itemMap.get("DSJS").toString());
- if((dsjs.subtract(jsNum)).compareTo(new BigDecimal("1"))==-1&&(dsjs.subtract(jsNum)).compareTo(new BigDecimal("-1"))==1){
- AFocusWarn record=new AFocusWarn();
- record.setSource("邻井复杂");
- record.setJh(jh);
- record.setCatogary(itemMap.get("SGMC").toString());
- record.setWarnTime(new Date());
- record.setBjnr(itemMap.get("FSJGJYY").toString());
- record.setServercost(System.currentTimeMillis() - startTime);
- record.setDsjs(itemMap.get("DSJS").toString());
- record.setKey(jh+jh);
- warnList.add(record);
- }
- }
- iaFocusWarnService.saveBatch(warnList);
- }
|