Commit 565ee8d114d4b795c61e72966a680b3a720492ca
1 parent
6f16079f
有人售票线路配人配车数据去重
Showing
1 changed file
with
23 additions
and
13 deletions
src/main/java/com/bsth/server_rs/bigdata/BigscreenService.java
| @@ -717,34 +717,44 @@ public class BigscreenService { | @@ -717,34 +717,44 @@ public class BigscreenService { | ||
| 717 | jsyList.add(jgMap); | 717 | jsyList.add(jgMap); |
| 718 | jsyList.add(nhMap); | 718 | jsyList.add(nhMap); |
| 719 | 719 | ||
| 720 | - String xlSql = "select (select name from bsth_c_line l where l.id = t.xl) line_name, a.jsy, b.spy, c.cl" | ||
| 721 | - + " from (select xl from bsth_c_s_ecinfo e where e.spy is not null and e.is_cancel = 0 group by xl) t" | ||
| 722 | - + " left join " | ||
| 723 | - + " (select a.xl, count(1) jsy from (select a.xl, a.jsy from bsth_c_s_ecinfo a where a.is_cancel = 0 and a.jsy is not null group by xl, jsy) a group by xl) a" | ||
| 724 | - + " on t.xl = a.xl" | ||
| 725 | - + " left join" | ||
| 726 | - + " (select b.xl, count(1) spy from (select b.xl, b.spy from bsth_c_s_ecinfo b where b.is_cancel = 0 and b.spy is not null group by xl, spy) b group by xl) b" | ||
| 727 | - + " on t.xl = b.xl" | ||
| 728 | - + " left join" | ||
| 729 | - + " (select c.xl, count(1) cl from (select c.xl, c.cl from bsth_c_s_ccinfo c where c.is_cancel = 0 and c.cl is not null and c.qyrq < now() group by xl, cl) c group by xl) c" | ||
| 730 | - + " on t.xl = c.xl"; | 720 | + String xlSql = "select a.jsy, b.spy, c.cl from" |
| 721 | + + " (select count(1) jsy from (select a.jsy from bsth_c_s_ecinfo a where a.is_cancel = 0 and a.spy is not null and a.jsy is not null group by jsy) a) a" | ||
| 722 | + + " LEFT JOIN" | ||
| 723 | + + " (select count(1) spy from (select b.spy from bsth_c_s_ecinfo b where b.is_cancel = 0 and b.spy is not null group by spy) b) b" | ||
| 724 | + + " on 1=1" | ||
| 725 | + + " LEFT JOIN" | ||
| 726 | + + " (select count(1) cl from (select c.cl from bsth_c_s_ccinfo c where c.is_cancel = 0 and c.cl is not null and c.xl in(select e.xl from bsth_c_s_ecinfo e where e.is_cancel = 0 and e.spy is not null) group by c.cl) c) c" | ||
| 727 | + + " on 1=1"; | ||
| 731 | List<Map<String, Object>> xlConfigList=jdbcTemplate.query(xlSql, | 728 | List<Map<String, Object>> xlConfigList=jdbcTemplate.query(xlSql, |
| 732 | new RowMapper<Map<String, Object>>(){ | 729 | new RowMapper<Map<String, Object>>(){ |
| 733 | @Override | 730 | @Override |
| 734 | public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | 731 | public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { |
| 735 | Map<String, Object> m=new HashMap<String,Object>(); | 732 | Map<String, Object> m=new HashMap<String,Object>(); |
| 736 | - m.put("lineName", rs.getString("line_name")); | ||
| 737 | m.put("jsy", rs.getString("jsy")); | 733 | m.put("jsy", rs.getString("jsy")); |
| 738 | m.put("spy", rs.getString("spy")); | 734 | m.put("spy", rs.getString("spy")); |
| 739 | m.put("cl", rs.getString("cl")); | 735 | m.put("cl", rs.getString("cl")); |
| 740 | return m; | 736 | return m; |
| 741 | } | 737 | } |
| 742 | }); | 738 | }); |
| 739 | + long jsy = 0l, spy = 0l, cl = 0l; | ||
| 740 | + for(Map<String, Object> t : xlConfigList){ | ||
| 741 | + if(t.get("jsy") != null){ | ||
| 742 | + jsy += Long.valueOf(t.get("jsy").toString()); | ||
| 743 | + } | ||
| 744 | + if(t.get("spy") != null){ | ||
| 745 | + spy += Long.valueOf(t.get("spy").toString()); | ||
| 746 | + } | ||
| 747 | + if(t.get("cl") != null){ | ||
| 748 | + cl += Long.valueOf(t.get("cl").toString()); | ||
| 749 | + } | ||
| 750 | + } | ||
| 743 | 751 | ||
| 744 | resMap.put("jsyList", jsyList); | 752 | resMap.put("jsyList", jsyList); |
| 745 | resMap.put("attList", attList); | 753 | resMap.put("attList", attList); |
| 746 | resMap.put("lackList", lackList); | 754 | resMap.put("lackList", lackList); |
| 747 | - resMap.put("configList", xlConfigList); | 755 | + resMap.put("salesmanJsy", jsy); |
| 756 | + resMap.put("salesmanSpy", spy); | ||
| 757 | + resMap.put("salesmanCl", cl); | ||
| 748 | 758 | ||
| 749 | return JSON.parseObject(JSON.toJSONString(resMap)); | 759 | return JSON.parseObject(JSON.toJSONString(resMap)); |
| 750 | } | 760 | } |