Commit af8425bbf74e4fdac234a48f1fb8fe27b29b13a7

Authored by 娄高锋
1 parent ed21cc24

SQL注入漏洞;

src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
@@ -17,6 +17,7 @@ import java.util.List; @@ -17,6 +17,7 @@ import java.util.List;
17 import java.util.Map; 17 import java.util.Map;
18 import java.util.Set; 18 import java.util.Set;
19 19
  20 +import org.apache.tomcat.jni.Shm;
20 import org.springframework.beans.factory.annotation.Autowired; 21 import org.springframework.beans.factory.annotation.Autowired;
21 import org.springframework.jdbc.core.JdbcTemplate; 22 import org.springframework.jdbc.core.JdbcTemplate;
22 import org.springframework.jdbc.core.RowMapper; 23 import org.springframework.jdbc.core.RowMapper;
@@ -88,21 +89,24 @@ public class FormsServiceImpl implements FormsService { @@ -88,21 +89,24 @@ public class FormsServiceImpl implements FormsService {
88 String line=map.get("line").toString(); 89 String line=map.get("line").toString();
89 String date=map.get("date").toString(); 90 String date=map.get("date").toString();
90 91
  92 + List<String> objList = new ArrayList<String>();
91 String sql="select " 93 String sql="select "
92 - + " r.cl_zbh,r.j_gh,r.j_name" 94 + + " r.cl_zbh,r.j_gh"
93 + " from bsth_c_s_sp_info_real r where " 95 + " from bsth_c_s_sp_info_real r where "
94 - + " r.schedule_date_str = '"+date+"'"  
95 - + " and r.xl_bm = '"+line+"' "  
96 - + " group by "  
97 - + " r.cl_zbh,r.j_gh,r.j_name"; 96 + + " r.schedule_date_str = ? "
  97 + + " and r.xl_bm = ? "
  98 + + " group by "
  99 + + " r.cl_zbh,r.j_gh";
  100 + objList.add(date);
  101 + objList.add(line);
98 102
99 - List<Waybillday> list = jdbcTemplate.query(sql, new RowMapper<Waybillday>() { 103 + List<Waybillday> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Waybillday>() {
100 104
101 @Override 105 @Override
102 public Waybillday mapRow(ResultSet arg0, int arg1) throws SQLException { 106 public Waybillday mapRow(ResultSet arg0, int arg1) throws SQLException {
103 Waybillday w=new Waybillday(); 107 Waybillday w=new Waybillday();
104 w.setJgh(arg0.getString("j_gh")); 108 w.setJgh(arg0.getString("j_gh"));
105 - w.setjName(arg0.getString("j_name")); 109 +// w.setjName(arg0.getString("j_name"));
106 w.setNbbm(arg0.getString("cl_zbh")); 110 w.setNbbm(arg0.getString("cl_zbh"));
107 return w; 111 return w;
108 112
@@ -118,14 +122,19 @@ public class FormsServiceImpl implements FormsService { @@ -118,14 +122,19 @@ public class FormsServiceImpl implements FormsService {
118 for (int j = 0; j < realList.size(); j++) { 122 for (int j = 0; j < realList.size(); j++) {
119 ScheduleRealInfo s=realList.get(j); 123 ScheduleRealInfo s=realList.get(j);
120 if(w.getNbbm().equals(s.getClZbh()) && w.getJgh().equals(s.getjGh())){ 124 if(w.getNbbm().equals(s.getClZbh()) && w.getJgh().equals(s.getjGh())){
121 - Set<ChildTaskPlan> cts = s.getcTasks();  
122 - if(cts != null && cts.size() > 0){ 125 + Set<ChildTaskPlan> cts = s.getcTasks();
  126 + if(cts != null && cts.size() > 0){
  127 + listInfo.add(s);
  128 + }else{
  129 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
123 listInfo.add(s); 130 listInfo.add(s);
124 - }else{  
125 - if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){  
126 - listInfo.add(s);  
127 - }  
128 } 131 }
  132 + }
  133 +
  134 + if((w.getjName() == null || w.getjName().trim().length() == 0)
  135 + && s.getjName() != null && s.getjName().length() > 0){
  136 + w.setjName(s.getjName());
  137 + }
129 } 138 }
130 } 139 }
131 140
@@ -161,8 +170,8 @@ public class FormsServiceImpl implements FormsService { @@ -161,8 +170,8 @@ public class FormsServiceImpl implements FormsService {
161 } 170 }
162 } 171 }
163 w.setJzl(String.valueOf(jzl)); 172 w.setJzl(String.valueOf(jzl));
164 - w.setYh(String.valueOf(yh));  
165 - w.setSh(String.valueOf(sh)); 173 + w.setYh(Arith.round(yh, 3)+"");
  174 + w.setSh(Arith.round(sh, 3)+"");
166 175
167 } 176 }
168 177
@@ -193,9 +202,9 @@ public class FormsServiceImpl implements FormsService { @@ -193,9 +202,9 @@ public class FormsServiceImpl implements FormsService {
193 way.setJzl1(ksgl.toString()); 202 way.setJzl1(ksgl.toString());
194 way.setJzl(jzl_.toString()); 203 way.setJzl(jzl_.toString());
195 way.setjName(""); 204 way.setjName("");
196 - way.setSh(sh_.toString()); 205 + way.setSh(Arith.round(sh_, 3)+"");
197 way.setZlc(lc_.toString()); 206 way.setZlc(lc_.toString());
198 - way.setYh(yh_.toString()); 207 + way.setYh(Arith.round(yh_, 3)+"");
199 if(list.size() > 0) 208 if(list.size() > 0)
200 list.add(way); 209 list.add(way);
201 210
@@ -205,26 +214,31 @@ public class FormsServiceImpl implements FormsService { @@ -205,26 +214,31 @@ public class FormsServiceImpl implements FormsService {
205 // 线路客流量报表 214 // 线路客流量报表
206 @Override 215 @Override
207 public List<Linepasswengerflow> linepasswengerflow(Map<String, Object> map) { 216 public List<Linepasswengerflow> linepasswengerflow(Map<String, Object> map) {
  217 + List<String> objList = new ArrayList<String>();
208 String sql = " SELECT r.schedule_date,s.station_name,l.name,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name" 218 String sql = " SELECT r.schedule_date,s.station_name,l.name,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name"
209 + " from bsth_c_stationroute s " 219 + " from bsth_c_stationroute s "
210 + " LEFT JOIN bsth_c_line l on s.line_code=l.line_code " 220 + " LEFT JOIN bsth_c_line l on s.line_code=l.line_code "
211 + " LEFT JOIN bsth_c_s_sp_info_real r on r.xl_bm=l.line_code" 221 + " LEFT JOIN bsth_c_s_sp_info_real r on r.xl_bm=l.line_code"
212 - + " where 1=1 "; 222 + + " where 1=1 ";
213 if(map.get("date").toString()!=""){ 223 if(map.get("date").toString()!=""){
214 - sql+="and r.schedule_date_str='"+map.get("date").toString() + "'"; 224 + sql+=" and r.schedule_date_str = ? ";
  225 + objList.add(map.get("date").toString());
215 } 226 }
216 if( map.get("line").toString()!=""){ 227 if( map.get("line").toString()!=""){
217 - sql+=" and l.line_code=" + map.get("line").toString(); 228 + sql+=" and l.line_code = ? ";
  229 + objList.add(map.get("line").toString());
218 } 230 }
219 - sql+= " AND r.gs_bm is not null"; 231 + sql+=" AND r.gs_bm is not null";
220 if(map.get("gsdmLine") != null && map.get("gsdmLine").toString()!=""){ 232 if(map.get("gsdmLine") != null && map.get("gsdmLine").toString()!=""){
221 - sql+=" and r.gs_bm='"+map.get("gsdmLine").toString()+"' "; 233 + sql+=" and r.gs_bm = ? ";
  234 + objList.add(map.get("gsdmLine").toString());
222 } 235 }
223 if(map.get("fgsdmLine") != null && map.get("fgsdmLine").toString()!=""){ 236 if(map.get("fgsdmLine") != null && map.get("fgsdmLine").toString()!=""){
224 - sql+=" and r.fgs_bm='"+map.get("fgsdmLine").toString()+"' "; 237 + sql+=" and r.fgs_bm = ? ";
  238 + objList.add(map.get("fgsdmLine").toString());
225 } 239 }
226 sql += " GROUP BY s.station_name,l.name,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "; 240 sql += " GROUP BY s.station_name,l.name,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name ";
227 - List<Linepasswengerflow> list = jdbcTemplate.query(sql, new RowMapper<Linepasswengerflow>() { 241 + List<Linepasswengerflow> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Linepasswengerflow>() {
228 242
229 @Override 243 @Override
230 public Linepasswengerflow mapRow(ResultSet arg0, int arg1) throws SQLException { 244 public Linepasswengerflow mapRow(ResultSet arg0, int arg1) throws SQLException {
@@ -253,48 +267,56 @@ public class FormsServiceImpl implements FormsService { @@ -253,48 +267,56 @@ public class FormsServiceImpl implements FormsService {
253 if(map.get("fgsdmManth") != null){ 267 if(map.get("fgsdmManth") != null){
254 fgsdmManth=map.get("fgsdmManth").toString(); 268 fgsdmManth=map.get("fgsdmManth").toString();
255 } 269 }
  270 + List<String> objList = new ArrayList<String>();
256 String sql ="select "; 271 String sql ="select ";
257 if(empnames.equals("驾驶员")){ 272 if(empnames.equals("驾驶员")){
258 - sql += " r.j_name,r.j_gh "; 273 + sql += " r.j_gh ";
259 }else if(empnames.equals("售票员")){ 274 }else if(empnames.equals("售票员")){
260 - sql += " r.s_gh,r.s_name"; 275 + sql += " r.s_gh ";
261 }else{ 276 }else{
262 - sql += " r.cl_zbh"; 277 + sql += " r.cl_zbh ";
263 } 278 }
264 sql += " from bsth_c_s_sp_info_real r where " 279 sql += " from bsth_c_s_sp_info_real r where "
265 - + " r.schedule_date_str >= '" + map.get("startDate").toString() + "' "  
266 - + " and r.schedule_date_str <='" + map.get("endDate").toString() + "' "; 280 + + " r.schedule_date_str >= ? "
  281 + + " and r.schedule_date_str <= ? ";
  282 + objList.add(map.get("startDate").toString());
  283 + objList.add(map.get("endDate").toString());
267 if(map.get("line")!=null&&!map.get("line").equals("")){ 284 if(map.get("line")!=null&&!map.get("line").equals("")){
268 - sql+=" and r.xl_bm='"+ map.get("line").toString() + "' "; 285 + sql += " and r.xl_bm = ? ";
  286 + objList.add(map.get("line").toString());
  287 + }
  288 + if(gsdmManth.length() > 0){
  289 + sql+=" and r.gs_bm = ? ";
  290 + objList.add(gsdmManth);
  291 + if(fgsdmManth.length() > 0){
  292 + sql+=" and r.fgs_bm = ? ";
  293 + objList.add(fgsdmManth);
  294 + }
269 } 295 }
270 - sql+=" and r.gs_bm like'%"+gsdmManth+"%' and r.fgs_bm like'%"+fgsdmManth+"%'";  
271 296
272 if(empnames.equals("驾驶员")){ 297 if(empnames.equals("驾驶员")){
273 sql += " GROUP BY " 298 sql += " GROUP BY "
274 - + "r.j_name,r.j_gh"; 299 + + " r.j_gh ";
275 }else if(empnames.equals("售票员")){ 300 }else if(empnames.equals("售票员")){
276 - sql+="and r.s_name is not null AND r.s_name !='' GROUP BY r.s_gh,r.s_name"; 301 + sql+="and r.s_gh is not null AND r.s_gh !='' GROUP BY r.s_gh";
277 }else{ 302 }else{
278 sql += " GROUP BY r.cl_zbh"; 303 sql += " GROUP BY r.cl_zbh";
279 } 304 }
280 305
281 - List<Shiftuehiclemanth> list = jdbcTemplate.query(sql, new RowMapper<Shiftuehiclemanth>() { 306 + List<Shiftuehiclemanth> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Shiftuehiclemanth>() {
282 307
283 @Override 308 @Override
284 public Shiftuehiclemanth mapRow(ResultSet arg0, int arg1) throws SQLException { 309 public Shiftuehiclemanth mapRow(ResultSet arg0, int arg1) throws SQLException {
285 Shiftuehiclemanth shif = new Shiftuehiclemanth(); 310 Shiftuehiclemanth shif = new Shiftuehiclemanth();
286 if(empnames.equals("驾驶员")){ 311 if(empnames.equals("驾驶员")){
287 - shif.setjName(arg0.getString("j_name")+"/"+arg0.getString("j_gh")); 312 +// shif.setjName(arg0.getString("j_name")+"/"+arg0.getString("j_gh"));
288 shif.setJgh(arg0.getString("j_gh")); 313 shif.setJgh(arg0.getString("j_gh"));
289 }else if(empnames.equals("售票员")){ 314 }else if(empnames.equals("售票员")){
290 - shif.setjName(arg0.getString("s_name")+"/"+arg0.getString("s_gh")); 315 +// shif.setjName(arg0.getString("s_name")+"/"+arg0.getString("s_gh"));
291 shif.setSgh(arg0.getString("s_gh")==null ? "":arg0.getString("s_gh")); 316 shif.setSgh(arg0.getString("s_gh")==null ? "":arg0.getString("s_gh"));
292 }else if(empnames.equals("车辆自编号")){ 317 }else if(empnames.equals("车辆自编号")){
293 shif.setjName(arg0.getString("cl_zbh")); 318 shif.setjName(arg0.getString("cl_zbh"));
294 } 319 }
295 -// shif.setJgh(arg0.getString("j_gh"));  
296 -// shif.setZbh(arg0.getString("cl_zbh"));  
297 -// shif.setjName(arg0.getString("s_gh")==null ? "":arg0.getString("s_gh"));  
298 return shif; 320 return shif;
299 } 321 }
300 }); 322 });
@@ -322,7 +344,11 @@ public class FormsServiceImpl implements FormsService { @@ -322,7 +344,11 @@ public class FormsServiceImpl implements FormsService {
322 list_s.add(s); 344 list_s.add(s);
323 } 345 }
324 } 346 }
325 - 347 +
  348 + if((d.getjName() == null || d.getjName().trim().length() == 0)
  349 + && s.getjName() != null && s.getjName().length() > 0){
  350 + d.setjName(s.getjName() + "/" + d.getJgh());
  351 + }
326 } 352 }
327 }else if(empnames.equals("售票员")){ 353 }else if(empnames.equals("售票员")){
328 String sgh=s.getsGh()==null?"":s.getsGh(); 354 String sgh=s.getsGh()==null?"":s.getsGh();
@@ -336,6 +362,11 @@ public class FormsServiceImpl implements FormsService { @@ -336,6 +362,11 @@ public class FormsServiceImpl implements FormsService {
336 list_s.add(s); 362 list_s.add(s);
337 } 363 }
338 } 364 }
  365 +
  366 + if((d.getjName() == null || d.getjName().trim().length() == 0)
  367 + && s.getjName() != null && s.getjName().length() > 0){
  368 + d.setjName(s.getsName() + "/" + d.getSgh());
  369 + }
339 } 370 }
340 }else if(empnames.equals("车辆自编号")){ 371 }else if(empnames.equals("车辆自编号")){
341 if(d.getjName().equals(s.getClZbh())){ 372 if(d.getjName().equals(s.getClZbh())){
@@ -413,54 +444,62 @@ public class FormsServiceImpl implements FormsService { @@ -413,54 +444,62 @@ public class FormsServiceImpl implements FormsService {
413 final String empnames=map.get("empnames").toString(); 444 final String empnames=map.get("empnames").toString();
414 String gsdmManth=""; 445 String gsdmManth="";
415 String fgsdmManth=""; 446 String fgsdmManth="";
416 - if(map.get("gsdmManth")!=null){ 447 + if(map.get("gsdmManth") != null){
417 gsdmManth=map.get("gsdmManth").toString(); 448 gsdmManth=map.get("gsdmManth").toString();
418 } 449 }
419 - if(map.get("fgsdmManth")!=null){ 450 + if(map.get("fgsdmManth") != null){
420 fgsdmManth=map.get("fgsdmManth").toString(); 451 fgsdmManth=map.get("fgsdmManth").toString();
421 } 452 }
  453 + List<String> objList = new ArrayList<String>();
422 String sql ="select "; 454 String sql ="select ";
423 if(empnames.equals("驾驶员")){ 455 if(empnames.equals("驾驶员")){
424 - sql += " r.j_name,r.j_gh "; 456 + sql += " r.j_gh ";
425 }else if(empnames.equals("售票员")){ 457 }else if(empnames.equals("售票员")){
426 - sql += " r.s_gh,r.s_name"; 458 + sql += " r.s_gh ";
427 }else{ 459 }else{
428 - sql += " r.cl_zbh"; 460 + sql += " r.cl_zbh ";
429 } 461 }
430 sql += " from bsth_c_s_sp_info_real r where " 462 sql += " from bsth_c_s_sp_info_real r where "
431 - + " r.schedule_date_str >= '" + map.get("startDate").toString() + "' "  
432 - + " and r.schedule_date_str <='" + map.get("endDate").toString() + "' "; 463 + + " r.schedule_date_str >= ? "
  464 + + " and r.schedule_date_str <= ? ";
  465 + objList.add(map.get("startDate").toString());
  466 + objList.add(map.get("endDate").toString());
433 if(map.get("line")!=null&&!map.get("line").equals("")){ 467 if(map.get("line")!=null&&!map.get("line").equals("")){
434 - sql+=" and r.xl_bm='"+ map.get("line").toString() + "' "; 468 + sql+=" and r.xl_bm = ? ";
  469 + objList.add(map.get("line").toString());
  470 + }
  471 + if(gsdmManth.length() > 0){
  472 + sql+=" and r.gs_bm = ? ";
  473 + objList.add(gsdmManth);
  474 + if(fgsdmManth.length() > 0){
  475 + sql+=" and r.fgs_bm = ? ";
  476 + objList.add(fgsdmManth);
  477 + }
435 } 478 }
436 - sql+=" and r.gs_bm like'%"+gsdmManth+"%' and r.fgs_bm like'%"+fgsdmManth+"%'";  
437 479
438 if(empnames.equals("驾驶员")){ 480 if(empnames.equals("驾驶员")){
439 sql += " GROUP BY " 481 sql += " GROUP BY "
440 - + "r.j_name,r.j_gh"; 482 + + " r.j_gh ";
441 }else if(empnames.equals("售票员")){ 483 }else if(empnames.equals("售票员")){
442 - sql+="and r.s_name is not null AND r.s_name !='' GROUP BY r.s_gh,r.s_name"; 484 + sql+="and r.s_gh is not null AND r.s_gh !='' GROUP BY r.s_gh";
443 }else{ 485 }else{
444 sql += " GROUP BY r.cl_zbh"; 486 sql += " GROUP BY r.cl_zbh";
445 } 487 }
446 488
447 - List<Shiftuehiclemanth> list = jdbcTemplate.query(sql, new RowMapper<Shiftuehiclemanth>() { 489 + List<Shiftuehiclemanth> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Shiftuehiclemanth>() {
448 490
449 @Override 491 @Override
450 public Shiftuehiclemanth mapRow(ResultSet arg0, int arg1) throws SQLException { 492 public Shiftuehiclemanth mapRow(ResultSet arg0, int arg1) throws SQLException {
451 Shiftuehiclemanth shif = new Shiftuehiclemanth(); 493 Shiftuehiclemanth shif = new Shiftuehiclemanth();
452 if(empnames.equals("驾驶员")){ 494 if(empnames.equals("驾驶员")){
453 - shif.setjName(arg0.getString("j_name")+"/"+arg0.getString("j_gh")); 495 +// shif.setjName(arg0.getString("j_name")+"/"+arg0.getString("j_gh"));
454 shif.setJgh(arg0.getString("j_gh")); 496 shif.setJgh(arg0.getString("j_gh"));
455 }else if(empnames.equals("售票员")){ 497 }else if(empnames.equals("售票员")){
456 - shif.setjName(arg0.getString("s_name")+"/"+arg0.getString("s_gh")); 498 +// shif.setjName(arg0.getString("s_name")+"/"+arg0.getString("s_gh"));
457 shif.setSgh(arg0.getString("s_gh")==null ? "":arg0.getString("s_gh")); 499 shif.setSgh(arg0.getString("s_gh")==null ? "":arg0.getString("s_gh"));
458 }else if(empnames.equals("车辆自编号")){ 500 }else if(empnames.equals("车辆自编号")){
459 shif.setjName(arg0.getString("cl_zbh")); 501 shif.setjName(arg0.getString("cl_zbh"));
460 } 502 }
461 -// shif.setJgh(arg0.getString("j_gh"));  
462 -// shif.setZbh(arg0.getString("cl_zbh"));  
463 -// shif.setjName(arg0.getString("s_gh")==null ? "":arg0.getString("s_gh"));  
464 return shif; 503 return shif;
465 } 504 }
466 }); 505 });
@@ -488,7 +527,11 @@ public class FormsServiceImpl implements FormsService { @@ -488,7 +527,11 @@ public class FormsServiceImpl implements FormsService {
488 list_s.add(s); 527 list_s.add(s);
489 } 528 }
490 } 529 }
491 - 530 +
  531 + if((d.getjName() == null || d.getjName().trim().length() == 0)
  532 + && s.getjName() != null && s.getjName().length() > 0){
  533 + d.setjName(s.getjName() + "/" + d.getJgh());
  534 + }
492 } 535 }
493 }else if(empnames.equals("售票员")){ 536 }else if(empnames.equals("售票员")){
494 String sgh=s.getsGh()==null?"":s.getsGh(); 537 String sgh=s.getsGh()==null?"":s.getsGh();
@@ -502,6 +545,11 @@ public class FormsServiceImpl implements FormsService { @@ -502,6 +545,11 @@ public class FormsServiceImpl implements FormsService {
502 list_s.add(s); 545 list_s.add(s);
503 } 546 }
504 } 547 }
  548 +
  549 + if((d.getjName() == null || d.getjName().trim().length() == 0)
  550 + && s.getjName() != null && s.getjName().length() > 0){
  551 + d.setjName(s.getsName() + "/" + d.getSgh());
  552 + }
505 } 553 }
506 }else if(empnames.equals("车辆自编号")){ 554 }else if(empnames.equals("车辆自编号")){
507 if(d.getjName().equals(s.getClZbh())){ 555 if(d.getjName().equals(s.getClZbh())){
@@ -620,23 +668,60 @@ public class FormsServiceImpl implements FormsService { @@ -620,23 +668,60 @@ public class FormsServiceImpl implements FormsService {
620 if(map.get("type") !=null){ 668 if(map.get("type") !=null){
621 type =map.get("type").toString(); 669 type =map.get("type").toString();
622 } 670 }
623 - String sql_ ="";  
624 - if(!type.equals("") && !statue.equals("")){  
625 - sql_ +=" order by "+statue+" "+type;  
626 - } 671 + List<String> objList = new ArrayList<String>();
627 String sql ="select t.* from (select r.schedule_date," 672 String sql ="select t.* from (select r.schedule_date,"
628 + " IFNULL(r.s_gh,'')as s_gh,r.cl_zbh," 673 + " IFNULL(r.s_gh,'')as s_gh,r.cl_zbh,"
629 + " r.xl_bm,r.j_gh,r.gs_bm,r.fgs_bm,r.lp_name" 674 + " r.xl_bm,r.j_gh,r.gs_bm,r.fgs_bm,r.lp_name"
630 + " FROM bsth_c_s_sp_info_real r where 1=1 " 675 + " FROM bsth_c_s_sp_info_real r where 1=1 "
631 - + " and r.schedule_date_str='"+date + "' "  
632 - + " and r.xl_bm = '"+line+"' "  
633 - + " and r.gs_bm like '%"+gsdmShif+"%' "  
634 - + " and r.fgs_bm like '%"+fgsdmShif+"%' "+sql_+") t"  
635 - + " GROUP BY t.schedule_date,t.xl_bm,t.cl_zbh,t.lp_name," 676 + + " and r.schedule_date_str = ? "
  677 + + " and r.xl_bm = ? ";
  678 + objList.add(date);
  679 + objList.add(line);
  680 + if(gsdmShif.length() > 0){
  681 + sql += " and r.gs_bm = ? ";
  682 + objList.add(gsdmShif);
  683 + if(fgsdmShif.length() > 0){
  684 + sql += " and r.fgs_bm = ? ";
  685 + objList.add(fgsdmShif);
  686 + }
  687 + }
  688 + if(statue.length() > 0){
  689 + switch (statue) {
  690 + case "j_name":
  691 + sql += " order by j_name ";
  692 + switch (type) {
  693 + case "asc":
  694 + sql += "asc ";
  695 + break;
  696 + case "desc":
  697 + sql += "desc ";
  698 + break;
  699 + default:
  700 + break;
  701 + }
  702 + break;
  703 + case "cl_zbh":
  704 + sql += " order by cl_zbh ";
  705 + switch (type) {
  706 + case "asc":
  707 + sql += "asc ";
  708 + break;
  709 + case "desc":
  710 + sql += "desc ";
  711 + break;
  712 + default:
  713 + break;
  714 + }
  715 + break;
  716 + default:
  717 + break;
  718 + }
  719 + }
  720 + sql += ") t GROUP BY t.schedule_date,t.xl_bm,t.cl_zbh,t.lp_name,"
636 + " t.j_gh,t.s_gh,t.gs_bm,t.fgs_bm "; 721 + " t.j_gh,t.s_gh,t.gs_bm,t.fgs_bm ";
637 722
638 723
639 - List<Shifday> list = jdbcTemplate.query(sql, new RowMapper<Shifday>() { 724 + List<Shifday> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Shifday>() {
640 725
641 @Override 726 @Override
642 public Shifday mapRow(ResultSet arg0, int arg1) throws SQLException { 727 public Shifday mapRow(ResultSet arg0, int arg1) throws SQLException {
@@ -790,21 +875,26 @@ public class FormsServiceImpl implements FormsService { @@ -790,21 +875,26 @@ public class FormsServiceImpl implements FormsService {
790 fgs =map.get("fgsdm").toString(); 875 fgs =map.get("fgsdm").toString();
791 } 876 }
792 877
793 - String sql="select * from bsth_c_chtoch where rq BETWEEN '"+ map.get("startDate").toString()+"' "  
794 - + " and '"+map.get("endDate").toString() +"'"; 878 + List<String> objList = new ArrayList<String>();
  879 + String sql="select * from bsth_c_chtoch where rq BETWEEN ? and ? ";
  880 + objList.add(map.get("startDate").toString());
  881 + objList.add(map.get("endDate").toString());
795 882
796 if(!line.equals("")){ 883 if(!line.equals("")){
797 - sql +=" and xl= '"+line+"'"; 884 + sql +=" and xl = ? ";
  885 + objList.add(line);
798 } 886 }
799 if(!gs.equals("")){ 887 if(!gs.equals("")){
800 - sql += " and gs= '"+gs+"'"; 888 + sql += " and gs = ? ";
  889 + objList.add(gs);
801 } 890 }
802 if(!fgs.equals("")){ 891 if(!fgs.equals("")){
803 - sql += " and fgs= '"+fgs+"'"; 892 + sql += " and fgs = ? ";
  893 + objList.add(fgs);
804 } 894 }
805 895
806 sql +=" order by rq"; 896 sql +=" order by rq";
807 - List<Changetochange> list = jdbcTemplate.query(sql, new RowMapper<Changetochange>() { 897 + List<Changetochange> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Changetochange>() {
808 @Override 898 @Override
809 public Changetochange mapRow(ResultSet arg0, int arg1) throws SQLException { 899 public Changetochange mapRow(ResultSet arg0, int arg1) throws SQLException {
810 Changetochange chan = new Changetochange(); 900 Changetochange chan = new Changetochange();
@@ -885,28 +975,34 @@ public class FormsServiceImpl implements FormsService { @@ -885,28 +975,34 @@ public class FormsServiceImpl implements FormsService {
885 List<Singledata> list_=new ArrayList<Singledata>(); 975 List<Singledata> list_=new ArrayList<Singledata>();
886 if(tjtype.equals("jsy")){ 976 if(tjtype.equals("jsy")){
887 //油统计 977 //油统计
888 - String sql="select r.j_gh, r.xl_bm,r.cl_zbh,r.j_name,r.fgs_bm" 978 + List<String> objList = new ArrayList<String>();
  979 + String sql="select r.j_gh, r.xl_bm,r.cl_zbh,r.fgs_bm"
889 + " from bsth_c_s_sp_info_real r where " 980 + " from bsth_c_s_sp_info_real r where "
890 - + " r.schedule_date_str = '"+startDate+"'"; 981 + + " r.schedule_date_str = ? ";
  982 + objList.add(startDate);
891 if(xlbm.length() != 0){ 983 if(xlbm.length() != 0){
892 - sql += " and r.xl_bm = '"+xlbm+"'"; 984 + sql += " and r.xl_bm = ? ";
  985 + objList.add(xlbm);
893 } 986 }
894 if(gsdm.length() != 0){ 987 if(gsdm.length() != 0){
895 - sql += " and r.gs_bm ='"+gsdm+"'"; 988 + sql += " and r.gs_bm = ? ";
  989 + objList.add(gsdm);
896 } 990 }
897 if(fgsdm.length() != 0){ 991 if(fgsdm.length() != 0){
898 - sql += " and r.fgs_bm ='"+fgsdm+"'"; 992 + sql += " and r.fgs_bm = ? ";
  993 + objList.add(fgsdm);
899 } 994 }
900 - sql += " group by r.fgs_bm,r.j_gh,r.xl_bm,r.cl_zbh,r.j_name " +  
901 - "order by r.xl_bm,r.cl_zbh";  
902 -  
903 - list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { 995 + sql += " group by r.fgs_bm,r.j_gh,r.xl_bm,r.cl_zbh " +
  996 + "order by r.xl_bm,r.cl_zbh";
  997 +
  998 +
  999 + list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Singledata>() {
904 @Override 1000 @Override
905 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { 1001 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
906 Singledata sin = new Singledata(); 1002 Singledata sin = new Singledata();
907 sin.setxL(arg0.getString("xl_bm")); 1003 sin.setxL(arg0.getString("xl_bm"));
908 sin.setJsy(arg0.getString("j_gh")); 1004 sin.setJsy(arg0.getString("j_gh"));
909 - sin.setjName(arg0.getString("j_name")); 1005 +// sin.setjName(arg0.getString("j_name"));
910 sin.setClzbh(arg0.getString("cl_zbh")); 1006 sin.setClzbh(arg0.getString("cl_zbh"));
911 sin.setgS(arg0.getString("fgs_bm")); 1007 sin.setgS(arg0.getString("fgs_bm"));
912 return sin; 1008 return sin;
@@ -915,24 +1011,39 @@ public class FormsServiceImpl implements FormsService { @@ -915,24 +1011,39 @@ public class FormsServiceImpl implements FormsService {
915 1011
916 Collections.sort(list,new SingledataByXlbm()); 1012 Collections.sort(list,new SingledataByXlbm());
917 1013
918 - String linesql=""; 1014 + List<String> nyObjList = new ArrayList<String>();
  1015 + String nysql="SELECT id,xlbm,nbbm,jsy,jzl as jzl,yh as yh,sh as sh,fgsdm FROM bsth_c_ylb"
  1016 + + " WHERE rq = ? ";
  1017 + nyObjList.add(startDate);
919 if(!xlbm.equals("")){ 1018 if(!xlbm.equals("")){
920 - linesql +=" and xlbm ='"+xlbm+"' "; 1019 + nysql +=" and xlbm = ? ";
  1020 + nyObjList.add(xlbm);
921 } 1021 }
922 if(!gsdm.equals("")){ 1022 if(!gsdm.equals("")){
923 - linesql +=" and ssgsdm ='"+gsdm+"' "; 1023 + nysql +=" and ssgsdm = ? ";
  1024 + nyObjList.add(gsdm);
924 } 1025 }
925 if(!fgsdm.equals("")){ 1026 if(!fgsdm.equals("")){
926 - linesql +=" and fgsdm ='"+fgsdm+"' "; 1027 + nysql +=" and fgsdm = ? ";
  1028 + nyObjList.add(fgsdm);
927 } 1029 }
928 - String nysql="SELECT id,xlbm,nbbm,jsy,jzl as jzl,yh as yh,sh as sh,fgsdm FROM bsth_c_ylb"  
929 - + " WHERE rq = '"+startDate+"'"  
930 - + linesql  
931 - + " union" 1030 + nysql += " union"
932 + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb" 1031 + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb"
933 - + " WHERE rq = '"+startDate+"'"  
934 - + linesql;  
935 - List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() { 1032 + + " WHERE rq = ? ";
  1033 + nyObjList.add(startDate);
  1034 + if(!xlbm.equals("")){
  1035 + nysql +=" and xlbm = ? ";
  1036 + nyObjList.add(xlbm);
  1037 + }
  1038 + if(!gsdm.equals("")){
  1039 + nysql +=" and ssgsdm = ? ";
  1040 + nyObjList.add(gsdm);
  1041 + }
  1042 + if(!fgsdm.equals("")){
  1043 + nysql +=" and fgsdm = ? ";
  1044 + nyObjList.add(fgsdm);
  1045 + }
  1046 + List<Singledata> listNy = jdbcTemplate.query(nysql, nyObjList.toArray(), new RowMapper<Singledata>() {
936 @Override 1047 @Override
937 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { 1048 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
938 Singledata sin = new Singledata(); 1049 Singledata sin = new Singledata();
@@ -967,13 +1078,12 @@ public class FormsServiceImpl implements FormsService { @@ -967,13 +1078,12 @@ public class FormsServiceImpl implements FormsService {
967 if(fages){ 1078 if(fages){
968 Singledata s=new Singledata(); 1079 Singledata s=new Singledata();
969 s.setJsy(jsy); 1080 s.setJsy(jsy);
970 - s.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));  
971 s.setClzbh(clzbh); 1081 s.setClzbh(clzbh);
972 s.setSgh(""); 1082 s.setSgh("");
973 s.setsName(""); 1083 s.setsName("");
974 s.setgS(BasicData.businessFgsCodeNameMap.get(sin_.getgS()+"_"+gsdm)); 1084 s.setgS(BasicData.businessFgsCodeNameMap.get(sin_.getgS()+"_"+gsdm));
975 s.setxL(line); 1085 s.setxL(line);
976 - s.setXlmc(BasicData.lineCode2NameMap.get(line)); 1086 + s.setXlmc(BasicData.lineCodeAllNameMap.get(line));
977 s.setJzl(sin_.getJzl()); 1087 s.setJzl(sin_.getJzl());
978 s.setHyl(sin_.getHyl()); 1088 s.setHyl(sin_.getHyl());
979 s.setUnyyyl(sin_.getUnyyyl()); 1089 s.setUnyyyl(sin_.getUnyyyl());
@@ -1002,9 +1112,9 @@ public class FormsServiceImpl implements FormsService { @@ -1002,9 +1112,9 @@ public class FormsServiceImpl implements FormsService {
1002 sh=Arith.add(sh, y.getUnyyyl()); 1112 sh=Arith.add(sh, y.getUnyyyl());
1003 } 1113 }
1004 } 1114 }
1005 - sin.setHyl(String.valueOf(yh));  
1006 - sin.setJzl(String.valueOf(jzl));  
1007 - sin.setUnyyyl(String.valueOf(sh)); 1115 + sin.setHyl(Arith.round(yh, 3) + "");
  1116 + sin.setJzl(Arith.round(jzl, 3) + "");
  1117 + sin.setUnyyyl(Arith.round(sh, 3) + "");
1008 1118
1009 List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); 1119 List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
1010 List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>(); 1120 List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>();
@@ -1022,6 +1132,11 @@ public class FormsServiceImpl implements FormsService { @@ -1022,6 +1132,11 @@ public class FormsServiceImpl implements FormsService {
1022 newList_.add(s); 1132 newList_.add(s);
1023 } 1133 }
1024 } 1134 }
  1135 +
  1136 + if((sin.getjName() == null || sin.getjName().trim().length() == 0)
  1137 + && s.getjName() != null && s.getjName().length() > 0){
  1138 + sin.setjName(s.getjName());
  1139 + }
1025 } 1140 }
1026 } 1141 }
1027 double jhgl=culateMileageService.culateJhgl(newList); 1142 double jhgl=culateMileageService.culateJhgl(newList);
@@ -1033,12 +1148,15 @@ public class FormsServiceImpl implements FormsService { @@ -1033,12 +1148,15 @@ public class FormsServiceImpl implements FormsService {
1033 1148
1034 double zyygl=Arith.add(yygl, ljgl); 1149 double zyygl=Arith.add(yygl, ljgl);
1035 double zksgl=Arith.add(ksgl, jcgl); 1150 double zksgl=Arith.add(ksgl, jcgl);
  1151 +
  1152 + if(sin.getjName() == null || sin.getjName().trim().length() == 0){
  1153 + sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
  1154 + }
1036 sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl))); 1155 sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
1037 sin.setEmptMileage(String.valueOf(zksgl)); 1156 sin.setEmptMileage(String.valueOf(zksgl));
1038 sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc))); 1157 sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
1039 sin.setXlmc(BasicData.lineCode2NameMap.get(line)); 1158 sin.setXlmc(BasicData.lineCode2NameMap.get(line));
1040 sin.setrQ(startDate); 1159 sin.setrQ(startDate);
1041 -// sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));  
1042 sin.setSgh(""); 1160 sin.setSgh("");
1043 sin.setsName(""); 1161 sin.setsName("");
1044 sin.setgS(BasicData.businessFgsCodeNameMap.get(sin.getgS()+"_"+gsdm)); 1162 sin.setgS(BasicData.businessFgsCodeNameMap.get(sin.getgS()+"_"+gsdm));
@@ -1046,24 +1164,29 @@ public class FormsServiceImpl implements FormsService { @@ -1046,24 +1164,29 @@ public class FormsServiceImpl implements FormsService {
1046 1164
1047 } 1165 }
1048 }else{ 1166 }else{
  1167 + List<String> objList = new ArrayList<String>();
1049 String sql="select r.s_gh,r.s_name, " 1168 String sql="select r.s_gh,r.s_name, "
1050 - + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm" 1169 + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm "
1051 + " from bsth_c_s_sp_info_real r where " 1170 + " from bsth_c_s_sp_info_real r where "
1052 - + " r.schedule_date_str = '"+startDate+"'"  
1053 - + " and r.s_gh !='' and r.s_gh is not null "; 1171 + + " r.schedule_date_str = ? "
  1172 + + " and r.s_gh !='' and r.s_gh is not null ";
  1173 + objList.add(startDate);
1054 if(!xlbm.equals("")){ 1174 if(!xlbm.equals("")){
1055 - sql += " and r.xl_bm = '"+xlbm+"'"; 1175 + sql += " and r.xl_bm = ? ";
  1176 + objList.add(xlbm);
1056 } 1177 }
1057 if(!gsdm.equals("")){ 1178 if(!gsdm.equals("")){
1058 - sql += " and r.gs_bm = '"+gsdm+"'"; 1179 + sql += " and r.gs_bm = ? ";
  1180 + objList.add(gsdm);
1059 } 1181 }
1060 if(!fgsdm.equals("")){ 1182 if(!fgsdm.equals("")){
1061 - sql += " and r.fgs_bm = '"+fgsdm+"'"; 1183 + sql += " and r.fgs_bm = ? ";
  1184 + objList.add(fgsdm);
1062 } 1185 }
1063 sql += " group by r.s_gh,r.s_name," 1186 sql += " group by r.s_gh,r.s_name,"
1064 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; 1187 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";
1065 1188
1066 - list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { 1189 + list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Singledata>() {
1067 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 1190 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
1068 @Override 1191 @Override
1069 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { 1192 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
@@ -1179,48 +1302,68 @@ public class FormsServiceImpl implements FormsService { @@ -1179,48 +1302,68 @@ public class FormsServiceImpl implements FormsService {
1179 List<Singledata> list_=new ArrayList<Singledata>(); 1302 List<Singledata> list_=new ArrayList<Singledata>();
1180 if(tjtype.equals("jsy")){ 1303 if(tjtype.equals("jsy")){
1181 //油统计 1304 //油统计
1182 - String sql="select r.j_gh, r.xl_bm,r.cl_zbh,r.j_name" 1305 + List<String> objList = new ArrayList<String>();
  1306 + String sql="select r.j_gh, r.xl_bm,r.cl_zbh"
1183 + " from bsth_c_s_sp_info_real r where " 1307 + " from bsth_c_s_sp_info_real r where "
1184 - + " r.schedule_date_str = '"+startDate+"'"; 1308 + + " r.schedule_date_str = ? ";
  1309 + objList.add(startDate);
1185 if(!xlbm.equals("")){ 1310 if(!xlbm.equals("")){
1186 - sql += " and r.xl_bm = '"+xlbm+"'"; 1311 + sql += " and r.xl_bm = ? ";
  1312 + objList.add(xlbm);
1187 } 1313 }
1188 if(!gsdm.equals("")){ 1314 if(!gsdm.equals("")){
1189 - sql += " and r.gs_bm='"+gsdm+"'"; 1315 + sql += " and r.gs_bm= ? ";
  1316 + objList.add(gsdm);
1190 } 1317 }
1191 if(!fgsdm.equals("")){ 1318 if(!fgsdm.equals("")){
1192 - sql += " and r.fgs_bm='"+fgsdm+"'"; 1319 + sql += " and r.fgs_bm = ? ";
  1320 + objList.add(fgsdm);
1193 } 1321 }
1194 - sql += " group by r.j_gh,r.xl_bm,r.cl_zbh,r.j_name order by r.xl_bm,r.cl_zbh";  
1195 - list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { 1322 + sql += " group by r.j_gh,r.xl_bm,r.cl_zbh order by r.xl_bm,r.cl_zbh";
  1323 + list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Singledata>() {
1196 @Override 1324 @Override
1197 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { 1325 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
1198 Singledata sin = new Singledata(); 1326 Singledata sin = new Singledata();
1199 sin.setxL(arg0.getString("xl_bm")); 1327 sin.setxL(arg0.getString("xl_bm"));
1200 sin.setJsy(arg0.getString("j_gh")); 1328 sin.setJsy(arg0.getString("j_gh"));
1201 - sin.setjName(arg0.getString("j_name")); 1329 +// sin.setjName(arg0.getString("j_name"));
1202 sin.setClzbh(arg0.getString("cl_zbh")); 1330 sin.setClzbh(arg0.getString("cl_zbh"));
1203 return sin; 1331 return sin;
1204 } 1332 }
1205 }); 1333 });
1206 - String linesql=""; 1334 + List<String> nyObjList = new ArrayList<String>();
  1335 + String nysql="SELECT id,xlbm,nbbm,jsy,jzl as jzl,yh as yh,sh as sh FROM bsth_c_ylb "
  1336 + + " WHERE rq = ? ";
  1337 + nyObjList.add(startDate);
1207 if(!xlbm.equals("")){ 1338 if(!xlbm.equals("")){
1208 - linesql += " and xlbm ='"+xlbm+"' "; 1339 + nysql +=" and xlbm = ? ";
  1340 + nyObjList.add(xlbm);
1209 } 1341 }
1210 - if(!gsdm.equals("")){  
1211 - linesql += " and ssgsdm ='"+gsdm+"'";  
1212 - }  
1213 - if(!fgsdm.equals("")){  
1214 - linesql += " and fgsdm ='"+fgsdm+"'";  
1215 - }  
1216 - String nysql="SELECT id,xlbm,nbbm, jsy,jzl as jzl,yh as yh,sh as sh FROM bsth_c_ylb "  
1217 - + " WHERE rq = '"+startDate+"'"  
1218 - + linesql  
1219 - + " union"  
1220 - + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh FROM bsth_c_dlb"  
1221 - + " WHERE rq = '"+startDate+"'"  
1222 - + linesql;  
1223 - List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() { 1342 + if(!gsdm.equals("")){
  1343 + nysql +=" and ssgsdm = ? ";
  1344 + nyObjList.add(gsdm);
  1345 + }
  1346 + if(!fgsdm.equals("")){
  1347 + nysql +=" and fgsdm = ? ";
  1348 + nyObjList.add(fgsdm);
  1349 + }
  1350 + nysql += " union"
  1351 + + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh FROM bsth_c_dlb "
  1352 + + " WHERE rq = ? ";
  1353 + nyObjList.add(startDate);
  1354 + if(!xlbm.equals("")){
  1355 + nysql +=" and xlbm = ? ";
  1356 + nyObjList.add(xlbm);
  1357 + }
  1358 + if(!gsdm.equals("")){
  1359 + nysql +=" and ssgsdm = ? ";
  1360 + nyObjList.add(gsdm);
  1361 + }
  1362 + if(!fgsdm.equals("")){
  1363 + nysql +=" and fgsdm = ? ";
  1364 + nyObjList.add(fgsdm);
  1365 + }
  1366 + List<Singledata> listNy = jdbcTemplate.query(nysql, nyObjList.toArray(), new RowMapper<Singledata>() {
1224 @Override 1367 @Override
1225 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { 1368 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
1226 Singledata sin = new Singledata(); 1369 Singledata sin = new Singledata();
@@ -1289,9 +1432,9 @@ public class FormsServiceImpl implements FormsService { @@ -1289,9 +1432,9 @@ public class FormsServiceImpl implements FormsService {
1289 sh=Arith.add(sh, y.getUnyyyl()); 1432 sh=Arith.add(sh, y.getUnyyyl());
1290 } 1433 }
1291 } 1434 }
1292 - sin.setHyl(String.valueOf(yh));  
1293 - sin.setJzl(String.valueOf(jzl));  
1294 - sin.setUnyyyl(String.valueOf(sh)); 1435 + sin.setHyl(Arith.round(yh, 3) + "");
  1436 + sin.setJzl(Arith.round(jzl, 3) + "");
  1437 + sin.setUnyyyl(Arith.round(sh, 3) + "");
1295 1438
1296 List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); 1439 List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
1297 List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>(); 1440 List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>();
@@ -1309,6 +1452,11 @@ public class FormsServiceImpl implements FormsService { @@ -1309,6 +1452,11 @@ public class FormsServiceImpl implements FormsService {
1309 newList_.add(s); 1452 newList_.add(s);
1310 } 1453 }
1311 } 1454 }
  1455 +
  1456 + if((sin.getjName() == null || sin.getjName().trim().length() == 0)
  1457 + && s.getjName() != null && s.getjName().length() > 0){
  1458 + sin.setjName(s.getjName());
  1459 + }
1312 } 1460 }
1313 } 1461 }
1314 double jhgl=culateMileageService.culateJhgl(newList); 1462 double jhgl=culateMileageService.culateJhgl(newList);
@@ -1318,6 +1466,9 @@ public class FormsServiceImpl implements FormsService { @@ -1318,6 +1466,9 @@ public class FormsServiceImpl implements FormsService {
1318 double ksgl=culateMileageService.culateKsgl(newList_); 1466 double ksgl=culateMileageService.culateKsgl(newList_);
1319 double jcgl=culateMileageService.culateJccgl(newList_); 1467 double jcgl=culateMileageService.culateJccgl(newList_);
1320 1468
  1469 + if(sin.getjName() == null || sin.getjName().trim().length() == 0){
  1470 + sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
  1471 + }
1321 double zyygl=Arith.add(yygl, ljgl); 1472 double zyygl=Arith.add(yygl, ljgl);
1322 double zksgl=Arith.add(ksgl, jcgl); 1473 double zksgl=Arith.add(ksgl, jcgl);
1323 sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl))); 1474 sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
@@ -1325,7 +1476,6 @@ public class FormsServiceImpl implements FormsService { @@ -1325,7 +1476,6 @@ public class FormsServiceImpl implements FormsService {
1325 sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc))); 1476 sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
1326 sin.setXlmc(BasicData.lineCode2NameMap.get(line)); 1477 sin.setXlmc(BasicData.lineCode2NameMap.get(line));
1327 sin.setrQ(startDate); 1478 sin.setrQ(startDate);
1328 -// sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));  
1329 sin.setSgh(""); 1479 sin.setSgh("");
1330 sin.setsName(""); 1480 sin.setsName("");
1331 sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); 1481 sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
@@ -1334,24 +1484,29 @@ public class FormsServiceImpl implements FormsService { @@ -1334,24 +1484,29 @@ public class FormsServiceImpl implements FormsService {
1334 } 1484 }
1335 Collections.sort(list_,new SingledataByXlbm()); 1485 Collections.sort(list_,new SingledataByXlbm());
1336 }else{ 1486 }else{
1337 - String sql="select r.s_gh,r.s_name, "  
1338 - + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm" 1487 + List<String> objList = new ArrayList<String>();
  1488 + String sql="select r.s_gh, "
  1489 + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm "
1339 + " from bsth_c_s_sp_info_real r where " 1490 + " from bsth_c_s_sp_info_real r where "
1340 - + " r.schedule_date_str = '"+startDate+"'"  
1341 - + " and r.s_gh !='' and r.s_gh is not null "; 1491 + + " r.schedule_date_str = ? "
  1492 + + " and r.s_gh !='' and r.s_gh is not null ";
  1493 + objList.add(startDate);
1342 if(!xlbm.equals("")){ 1494 if(!xlbm.equals("")){
1343 - sql += " and r.xl_bm = '"+xlbm+"'"; 1495 + sql += " and r.xl_bm = ? ";
  1496 + objList.add(xlbm);
1344 } 1497 }
1345 if(!gsdm.equals("")){ 1498 if(!gsdm.equals("")){
1346 - sql += " and r.gs_bm='"+gsdm+"'"; 1499 + sql += " and r.gs_bm = ? ";
  1500 + objList.add(gsdm);
1347 } 1501 }
1348 if(!fgsdm.equals("")){ 1502 if(!fgsdm.equals("")){
1349 - sql += " and r.fgs_bm='"+fgsdm+"'"; 1503 + sql += " and r.fgs_bm = ? ";
  1504 + objList.add(fgsdm);
1350 } 1505 }
1351 - sql += " group by r.s_gh,r.s_name," 1506 + sql += " group by r.s_gh,"
1352 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; 1507 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";
1353 -  
1354 - list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { 1508 +
  1509 + list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Singledata>() {
1355 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 1510 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
1356 @Override 1511 @Override
1357 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { 1512 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
@@ -1360,7 +1515,7 @@ public class FormsServiceImpl implements FormsService { @@ -1360,7 +1515,7 @@ public class FormsServiceImpl implements FormsService {
1360 sin.setxL(arg0.getString("xl_bm")); 1515 sin.setxL(arg0.getString("xl_bm"));
1361 sin.setClzbh(arg0.getString("cl_zbh")); 1516 sin.setClzbh(arg0.getString("cl_zbh"));
1362 sin.setSgh(arg0.getString("s_gh")); 1517 sin.setSgh(arg0.getString("s_gh"));
1363 - sin.setsName(arg0.getString("s_name")); 1518 +// sin.setsName(arg0.getString("s_name"));
1364 return sin; 1519 return sin;
1365 } 1520 }
1366 }); 1521 });
@@ -1386,6 +1541,11 @@ public class FormsServiceImpl implements FormsService { @@ -1386,6 +1541,11 @@ public class FormsServiceImpl implements FormsService {
1386 newList_.add(s); 1541 newList_.add(s);
1387 } 1542 }
1388 } 1543 }
  1544 +
  1545 + if((sin.getsName() == null || sin.getsName().trim().length() == 0)
  1546 + && s.getsName() != null && s.getsName().length() > 0){
  1547 + sin.setsName(s.getsName());
  1548 + }
1389 } 1549 }
1390 } 1550 }
1391 double jhgl=culateMileageService.culateJhgl(newList); 1551 double jhgl=culateMileageService.culateJhgl(newList);
@@ -1403,6 +1563,9 @@ public class FormsServiceImpl implements FormsService { @@ -1403,6 +1563,9 @@ public class FormsServiceImpl implements FormsService {
1403 double zksgl=culateMileageService.culateSjfyylc_spy(newList_); 1563 double zksgl=culateMileageService.culateSjfyylc_spy(newList_);
1404 sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl))); 1564 sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
1405 1565
  1566 + if(sin.getsName() == null || sin.getsName().trim().length() == 0){
  1567 + sin.setsName(BasicData.allPerson.get(gsdm+"-"+jsy));
  1568 + }
1406 sin.setEmptMileage(String.valueOf(zksgl)); 1569 sin.setEmptMileage(String.valueOf(zksgl));
1407 sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc))); 1570 sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
1408 sin.setXlmc(BasicData.lineCode2NameMap.get(line)); 1571 sin.setXlmc(BasicData.lineCode2NameMap.get(line));
@@ -1420,281 +1583,6 @@ public class FormsServiceImpl implements FormsService { @@ -1420,281 +1583,6 @@ public class FormsServiceImpl implements FormsService {
1420 return list_; 1583 return list_;
1421 } 1584 }
1422 1585
1423 - /*// 路单数据  
1424 - @Override  
1425 - public List<Singledata> singledatatj(Map<String, Object> map) {  
1426 -  
1427 - String gsdm="";  
1428 - if(map.get("gsdmSing")!=null){  
1429 - gsdm=map.get("gsdmSing").toString();  
1430 - }  
1431 - String fgsdm="";  
1432 - if(map.get("fgsdmSing")!=null){  
1433 - fgsdm=map.get("fgsdmSing").toString();  
1434 - }  
1435 -  
1436 - String tjtype=map.get("tjtype").toString();  
1437 - String xlbm=map.get("line").toString().trim();  
1438 - startDate = map.get("startDate").toString();  
1439 -  
1440 - List<ScheduleRealInfo> listReal=new ArrayList<ScheduleRealInfo>();  
1441 - if(xlbm.equals("")){  
1442 - listReal=scheduleRealInfoRepository.scheduleByDateAndLineByGs_(gsdm, fgsdm, startDate);  
1443 - }else{  
1444 - listReal=scheduleRealInfoRepository.scheduleByDateAndLineQp(xlbm, startDate);  
1445 - }  
1446 - List<Singledata> list=new ArrayList<Singledata>();  
1447 - List<Singledata> listY=new ArrayList<Singledata>();  
1448 - List<Singledata> listD=new ArrayList<Singledata>();  
1449 -  
1450 - if(tjtype.equals("jsy")){  
1451 - //油统计  
1452 - String sql="select xlbm,nbbm,jsy from bsth_c_ylb where rq='"+startDate+"'";  
1453 - if(xlbm.equals("")){  
1454 - sql += " and ssgsdm= '"+gsdm+"' and fgsdm= '"+fgsdm+"'";  
1455 - }else{  
1456 - sql +=" and xlbm= '"+xlbm+"'";  
1457 - }  
1458 - sql += " group by xlbm,nbbm,jsy";  
1459 - listY = jdbcTemplate.query(sql, new RowMapper<Singledata>() {  
1460 - @Override  
1461 - public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {  
1462 - Singledata sin = new Singledata();  
1463 - sin.setxL(arg0.getString("xlbm"));  
1464 - sin.setJsy(arg0.getString("jsy"));  
1465 - sin.setClzbh(arg0.getString("nbbm"));  
1466 - return sin;  
1467 - }  
1468 - });  
1469 -  
1470 - List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm");  
1471 - for (int i = 0; i < listY.size(); i++) {  
1472 - Singledata sin=listY.get(i);  
1473 - String jsy=sin.getJsy();  
1474 - String line=sin.getxL();  
1475 - String clzbh=sin.getClzbh();  
1476 -  
1477 - double jzl=0.0;  
1478 - double yh=0.0;  
1479 - double sh=0.0;  
1480 - for (int j = 0; j < listYlb.size(); j++) {  
1481 - Ylb y=listYlb.get(j);  
1482 - if(y.getJsy().equals(jsy)  
1483 - &&y.getNbbm().equals(clzbh)  
1484 - &&y.getXlbm().equals(line)){  
1485 - jzl=Arith.add(jzl, y.getJzl());  
1486 - yh=Arith.add(yh, y.getYh());  
1487 - sh=Arith.add(sh, y.getSh());  
1488 - }  
1489 - }  
1490 - sin.setHyl(String.valueOf(yh));  
1491 - sin.setJzl(String.valueOf(jzl));  
1492 - sin.setUnyyyl(String.valueOf(sh));  
1493 -  
1494 - List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();  
1495 - List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>();  
1496 - for (int j = 0; j < listReal.size(); j++) {  
1497 - ScheduleRealInfo s=listReal.get(j);  
1498 - if(s.getjGh().equals(jsy)  
1499 - && s.getClZbh().equals(clzbh)  
1500 - &&s.getXlBm().equals(line)){  
1501 - newList.add(s);  
1502 - Set<ChildTaskPlan> cts = s.getcTasks();  
1503 - if(cts != null && cts.size() > 0){  
1504 - newList_.add(s);  
1505 - }else{  
1506 - if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){  
1507 - newList_.add(s);  
1508 - }  
1509 - }  
1510 - }  
1511 - }  
1512 - double jhgl=culateMileageService.culateJhgl(newList);  
1513 - double jhjcc=culateMileageService.culateJhJccgl(newList);  
1514 - double yygl=culateMileageService.culateSjgl(newList_);  
1515 - double ljgl=culateMileageService.culateLjgl(newList_);  
1516 - double ksgl=culateMileageService.culateKsgl(newList_);  
1517 - double jcgl=culateMileageService.culateJccgl(newList_);  
1518 -  
1519 - double zyygl=Arith.add(yygl, ljgl);  
1520 - double zksgl=Arith.add(ksgl, jcgl);  
1521 - sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));  
1522 - sin.setEmptMileage(String.valueOf(zksgl));  
1523 - sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));  
1524 - sin.setXlmc(BasicData.lineCode2NameMap.get(line));  
1525 - sin.setrQ(startDate);  
1526 - sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));  
1527 - sin.setSgh("");  
1528 - sin.setsName("");  
1529 - }  
1530 -  
1531 -  
1532 - //电量计算  
1533 - String sqldl="select xlbm,nbbm,jsy from bsth_c_dlb where rq='"+startDate+"'";  
1534 - if(xlbm.equals("")){  
1535 - sqldl += " and ssgsdm= '"+gsdm+"' and fgsdm= '"+fgsdm+"'";  
1536 - }else{  
1537 - sqldl +=" and xlbm= '"+xlbm+"'";  
1538 - }  
1539 - sqldl += " group by xlbm,nbbm,jsy";  
1540 - listD = jdbcTemplate.query(sqldl, new RowMapper<Singledata>() {  
1541 - @Override  
1542 - public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {  
1543 - Singledata sin = new Singledata();  
1544 - sin.setxL(arg0.getString("xlbm"));  
1545 - sin.setJsy(arg0.getString("jsy"));  
1546 - sin.setClzbh(arg0.getString("nbbm"));  
1547 - return sin;  
1548 - }  
1549 - });  
1550 - List<Dlb> listDlb= dlbRepository.obtainDl(startDate, gsdm, fgsdm, xlbm, "", "xlbm");  
1551 -  
1552 - for (int i = 0; i < listD.size(); i++) {  
1553 - Singledata sin=listD.get(i);  
1554 - String jsy=sin.getJsy();  
1555 - String line=sin.getxL();  
1556 - String clzbh=sin.getClzbh();  
1557 -  
1558 - double jzl=0.0;  
1559 - double yh=0.0;  
1560 - double sh=0.0;  
1561 - for (int j = 0; j < listDlb.size(); j++) {  
1562 - Dlb d=listDlb.get(j);  
1563 - if(d.getJsy().equals(jsy)  
1564 - &&d.getNbbm().equals(clzbh)  
1565 - &&d.getXlbm().equals(line)){  
1566 - jzl=Arith.add(jzl, d.getCdl());  
1567 - yh=Arith.add(yh, d.getHd());  
1568 - sh=Arith.add(sh, d.getSh());  
1569 - }  
1570 - }  
1571 - sin.setHyl(String.valueOf(yh));  
1572 - sin.setJzl(String.valueOf(jzl));  
1573 - sin.setUnyyyl(String.valueOf(sh));  
1574 -  
1575 - List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();  
1576 - List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>();  
1577 - for (int j = 0; j < listReal.size(); j++) {  
1578 - ScheduleRealInfo s=listReal.get(j);  
1579 - if(s.getjGh().equals(jsy)  
1580 - && s.getClZbh().equals(clzbh)  
1581 - &&s.getXlBm().equals(line)){  
1582 - newList.add(s);  
1583 - Set<ChildTaskPlan> cts = s.getcTasks();  
1584 - if(cts != null && cts.size() > 0){  
1585 - newList_.add(s);  
1586 - }else{  
1587 - if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){  
1588 - newList_.add(s);  
1589 - }  
1590 - }  
1591 - }  
1592 - }  
1593 - double jhgl=culateMileageService.culateJhgl(newList);  
1594 - double jhjcc=culateMileageService.culateJhJccgl(newList);  
1595 - double yygl=culateMileageService.culateSjgl(newList_);  
1596 - double ljgl=culateMileageService.culateLjgl(newList_);  
1597 - double ksgl=culateMileageService.culateKsgl(newList_);  
1598 - double jcgl=culateMileageService.culateJccgl(newList_);  
1599 -  
1600 - double zyygl=Arith.add(yygl, ljgl);  
1601 - double zksgl=Arith.add(ksgl, jcgl);  
1602 - sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));  
1603 - sin.setEmptMileage(String.valueOf(zksgl));  
1604 - sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));  
1605 - sin.setXlmc(BasicData.lineCode2NameMap.get(line));  
1606 - sin.setrQ(startDate);  
1607 - sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));  
1608 - sin.setSgh("");  
1609 - sin.setsName("");  
1610 - }  
1611 -  
1612 -  
1613 - Collections.sort(listY,new SingledataByXlbm());  
1614 - Collections.sort(listD,new SingledataByXlbm());  
1615 - list.addAll(listY);  
1616 - list.addAll(listD);  
1617 - }else{  
1618 - String sql="select r.s_gh,r.s_name, "  
1619 - + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm"  
1620 - + " from bsth_c_s_sp_info_real r where "  
1621 - + " r.schedule_date_str = '"+startDate+"'"  
1622 - + " and r.s_gh !='' and r.s_gh is not null ";  
1623 - if(xlbm.equals("")){  
1624 - sql +="and r.gs_bm='"+gsdm+"' "  
1625 - + " and r.fgs_bm='"+fgsdm+"'";  
1626 - }else{  
1627 - sql += " and r.xl_bm = '"+xlbm+"'";  
1628 - }  
1629 - sql += " group by r.s_gh,r.s_name,"  
1630 - + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";  
1631 -  
1632 - list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {  
1633 - //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");  
1634 - @Override  
1635 - public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {  
1636 - Singledata sin = new Singledata();  
1637 - sin.setrQ(startDate);  
1638 - sin.setxL(arg0.getString("xl_bm"));  
1639 - sin.setClzbh(arg0.getString("cl_zbh"));  
1640 - sin.setSgh(arg0.getString("s_gh"));  
1641 - sin.setsName(arg0.getString("s_name"));  
1642 - return sin;  
1643 - }  
1644 - });  
1645 -  
1646 - for (int i = 0; i < list.size(); i++) {  
1647 - Singledata sin=list.get(i);  
1648 - String jsy=sin.getSgh();  
1649 - String line=sin.getxL();  
1650 - String clzbh=sin.getClzbh();  
1651 - List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();  
1652 - List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>();  
1653 -  
1654 - for (int j = 0; j < listReal.size(); j++) {  
1655 - ScheduleRealInfo s=listReal.get(j);  
1656 - if(s.getsGh().equals(jsy) && s.getClZbh().equals(clzbh)  
1657 - &&s.getXlBm().equals(line)){  
1658 - newList.add(s);  
1659 - Set<ChildTaskPlan> cts = s.getcTasks();  
1660 - if(cts != null && cts.size() > 0){  
1661 - newList_.add(s);  
1662 - }else{  
1663 - if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){  
1664 - newList_.add(s);  
1665 - }  
1666 - }  
1667 - }  
1668 - }  
1669 - double jhgl=culateMileageService.culateJhgl(newList);  
1670 - double jhjcc=culateMileageService.culateJhJccgl(newList);  
1671 - double yygl=culateMileageService.culateSjgl(newList_);  
1672 - double ljgl=culateMileageService.culateLjgl(newList_);  
1673 - double ksgl=culateMileageService.culateKsgl(newList_);  
1674 - double jcgl=culateMileageService.culateJccgl(newList_);  
1675 -  
1676 - double zyygl=Arith.add(yygl, ljgl);  
1677 - double zksgl=Arith.add(ksgl, jcgl);  
1678 -  
1679 - sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));  
1680 -  
1681 - sin.setEmptMileage(String.valueOf(zksgl));  
1682 - sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));  
1683 - sin.setxL(BasicData.lineCode2NameMap.get(line));  
1684 - sin.setClzbh(clzbh);  
1685 - sin.setJsy("");  
1686 - sin.setjName("");  
1687 - sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));  
1688 - sin.setHyl("");  
1689 - sin.setJzl("");  
1690 - sin.setUnyyyl("");  
1691 - }  
1692 - Collections.sort(list,new SingledataByXlbm());  
1693 - }  
1694 -  
1695 - return list;  
1696 -  
1697 - }*/  
1698 1586
1699 // 路单数据 1587 // 路单数据
1700 @Override 1588 @Override
@@ -1711,39 +1599,31 @@ public class FormsServiceImpl implements FormsService { @@ -1711,39 +1599,31 @@ public class FormsServiceImpl implements FormsService {
1711 1599
1712 String xlbm=map.get("line").toString().trim(); 1600 String xlbm=map.get("line").toString().trim();
1713 1601
1714 - /*SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");  
1715 - SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日");  
1716 - Date d = null;  
1717 - Date d1 = null;  
1718 - try {  
1719 - d = sdf.parse(map.get("startDate").toString());  
1720 - d1 = sdf.parse(map.get("endDate").toString());  
1721 - } catch (ParseException e) {  
1722 1602
1723 - e.printStackTrace();  
1724 - }  
1725 - String rq2 = sdf1.format(d);  
1726 - String rq3 = sdf1.format(d1);*/  
1727 -  
1728 -// rq = rq2 + "-" + rq3;  
1729 startDate = map.get("startDate").toString(); 1603 startDate = map.get("startDate").toString();
1730 1604
  1605 +
  1606 + List<String> objList = new ArrayList<String>();
1731 String sql="select r.s_gh,r.s_name, " 1607 String sql="select r.s_gh,r.s_name, "
1732 - + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm,xl_name"  
1733 - + " from bsth_c_s_sp_info_real r where r.schedule_date_str = '"+startDate+"'"; 1608 + + " r.xl_bm,r.cl_zbh,r.j_gh,r.gs_bm,r.fgs_bm,xl_name"
  1609 + + " from bsth_c_s_sp_info_real r where r.schedule_date_str = ? ";
  1610 + objList.add(startDate);
1734 if(!xlbm.equals("")){ 1611 if(!xlbm.equals("")){
1735 - sql += " and r.xl_bm = '"+xlbm+"'"; 1612 + sql += " and r.xl_bm = ? ";
  1613 + objList.add(xlbm);
1736 } 1614 }
1737 if(!gsdm.equals("")){ 1615 if(!gsdm.equals("")){
1738 - sql += " and r.gs_bm='"+gsdm+"'"; 1616 + sql += " and r.gs_bm = ? ";
  1617 + objList.add(gsdm);
1739 } 1618 }
1740 if(!fgsdm.equals("")){ 1619 if(!fgsdm.equals("")){
1741 - sql += " and r.fgs_bm='"+fgsdm+"'"; 1620 + sql += " and r.fgs_bm = ? ";
  1621 + objList.add(fgsdm);
1742 } 1622 }
1743 sql += " group by r.s_gh,r.s_name," 1623 sql += " group by r.s_gh,r.s_name,"
1744 - + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm,xl_name order by r.xl_bm,r.cl_zbh"; 1624 + + " r.xl_bm,r.cl_zbh,r.j_gh,r.gs_bm,r.fgs_bm,xl_name order by r.xl_bm,r.cl_zbh";
1745 1625
1746 - List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { 1626 + List<Singledata> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Singledata>() {
1747 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 1627 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
1748 @Override 1628 @Override
1749 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { 1629 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
@@ -1752,7 +1632,7 @@ public class FormsServiceImpl implements FormsService { @@ -1752,7 +1632,7 @@ public class FormsServiceImpl implements FormsService {
1752 sin.setxL(arg0.getString("xl_bm")); 1632 sin.setxL(arg0.getString("xl_bm"));
1753 sin.setClzbh(arg0.getString("cl_zbh")); 1633 sin.setClzbh(arg0.getString("cl_zbh"));
1754 sin.setJsy(arg0.getString("j_gh")); 1634 sin.setJsy(arg0.getString("j_gh"));
1755 - sin.setjName(arg0.getString("j_name")); 1635 +// sin.setjName(arg0.getString("j_name"));
1756 sin.setSgh(arg0.getString("s_gh")); 1636 sin.setSgh(arg0.getString("s_gh"));
1757 sin.setsName(arg0.getString("s_name")); 1637 sin.setsName(arg0.getString("s_name"));
1758 sin.setXlmc(arg0.getString("xl_name")); 1638 sin.setXlmc(arg0.getString("xl_name"));
@@ -1761,7 +1641,6 @@ public class FormsServiceImpl implements FormsService { @@ -1761,7 +1641,6 @@ public class FormsServiceImpl implements FormsService {
1761 return sin; 1641 return sin;
1762 } 1642 }
1763 }); 1643 });
1764 - DecimalFormat df = new DecimalFormat("0.00");  
1765 List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm"); 1644 List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm");
1766 List<Dlb> listDlb= dlbRepository.obtainDl(startDate, gsdm, fgsdm, xlbm, "", "xlbm"); 1645 List<Dlb> listDlb= dlbRepository.obtainDl(startDate, gsdm, fgsdm, xlbm, "", "xlbm");
1767 List<ScheduleRealInfo> listReal=scheduleRealInfoRepository.scheduleByDateAndLine(xlbm, startDate); 1646 List<ScheduleRealInfo> listReal=scheduleRealInfoRepository.scheduleByDateAndLine(xlbm, startDate);
@@ -1779,6 +1658,11 @@ public class FormsServiceImpl implements FormsService { @@ -1779,6 +1658,11 @@ public class FormsServiceImpl implements FormsService {
1779 if(s.getjGh().equals(jsy) && s.getClZbh().equals(clzbh) 1658 if(s.getjGh().equals(jsy) && s.getClZbh().equals(clzbh)
1780 &&s.getXlBm().equals(xl)&&s.getsGh().equals(spy)){ 1659 &&s.getXlBm().equals(xl)&&s.getsGh().equals(spy)){
1781 newList.add(s); 1660 newList.add(s);
  1661 +
  1662 + if((sin.getjName() == null || sin.getjName().trim().length() == 0)
  1663 + && s.getjName() != null && s.getjName().length() > 0){
  1664 + sin.setjName(s.getjName());
  1665 + }
1782 } 1666 }
1783 } 1667 }
1784 1668
@@ -1818,9 +1702,9 @@ public class FormsServiceImpl implements FormsService { @@ -1818,9 +1702,9 @@ public class FormsServiceImpl implements FormsService {
1818 } 1702 }
1819 if(zlcs>0){ 1703 if(zlcs>0){
1820 double lcbfb= zlc/zlcs; 1704 double lcbfb= zlc/zlcs;
1821 - sin.setHyl(df.format(yhl*lcbfb));  
1822 - sin.setJzl(df.format(jzl*lcbfb));  
1823 - sin.setUnyyyl(df.format(fyy*lcbfb)); 1705 + sin.setHyl(Arith.round(yhl*lcbfb, 3) + "");
  1706 + sin.setJzl(Arith.round(jzl*lcbfb, 3) + "");
  1707 + sin.setUnyyyl(Arith.round(fyy*lcbfb, 3) + "");
1824 } 1708 }
1825 } 1709 }
1826 return list; 1710 return list;
@@ -1855,7 +1739,6 @@ public class FormsServiceImpl implements FormsService { @@ -1855,7 +1739,6 @@ public class FormsServiceImpl implements FormsService {
1855 List<Singledata> listD=new ArrayList<Singledata>(); 1739 List<Singledata> listD=new ArrayList<Singledata>();
1856 1740
1857 if(tjtype.equals("jsy")){ 1741 if(tjtype.equals("jsy")){
1858 - DecimalFormat df = new DecimalFormat("0.00");  
1859 List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm"); 1742 List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm");
1860 for (int i = 0; i < listYlb.size(); i++) { 1743 for (int i = 0; i < listYlb.size(); i++) {
1861 Ylb y=listYlb.get(i); 1744 Ylb y=listYlb.get(i);
@@ -1929,15 +1812,17 @@ public class FormsServiceImpl implements FormsService { @@ -1929,15 +1812,17 @@ public class FormsServiceImpl implements FormsService {
1929 sin.setrQ(startDate); 1812 sin.setrQ(startDate);
1930 if(newList.size()>0){ 1813 if(newList.size()>0){
1931 sin.setjName(newList.get(0).getjName()); 1814 sin.setjName(newList.get(0).getjName());
  1815 + }if(y.getJname()!=null && y.getJname().length() > 0){
  1816 + sin.setjName(y.getJname());
1932 }else{ 1817 }else{
1933 sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); 1818 sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
1934 } 1819 }
1935 sin.setSgh(""); 1820 sin.setSgh("");
1936 sin.setsName(""); 1821 sin.setsName("");
1937 sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); 1822 sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
1938 - sin.setHyl(df.format(y.getYh()));  
1939 - sin.setJzl(df.format(y.getJzl()));  
1940 - sin.setUnyyyl(df.format(y.getSh())); 1823 + sin.setHyl(Arith.round(y.getYh(), 3) + "");
  1824 + sin.setJzl(Arith.round(y.getJzl(), 3) + "");
  1825 + sin.setUnyyyl(Arith.round(y.getSh(), 3) + "");
1941 listY.add(sin); 1826 listY.add(sin);
1942 } 1827 }
1943 1828
@@ -2009,20 +1894,23 @@ public class FormsServiceImpl implements FormsService { @@ -2009,20 +1894,23 @@ public class FormsServiceImpl implements FormsService {
2009 sin.setXlmc(y.getXlname()); 1894 sin.setXlmc(y.getXlname());
2010 }else{ 1895 }else{
2011 sin.setXlmc(y.getLinename()); 1896 sin.setXlmc(y.getLinename());
2012 - } sin.setClzbh(clzbh); 1897 + }
  1898 + sin.setClzbh(clzbh);
2013 sin.setJsy(jsy); 1899 sin.setJsy(jsy);
2014 sin.setrQ(startDate); 1900 sin.setrQ(startDate);
2015 if(newList.size()>0){ 1901 if(newList.size()>0){
2016 sin.setjName(newList.get(0).getjName()); 1902 sin.setjName(newList.get(0).getjName());
  1903 + }if(y.getJname()!=null && y.getJname().length() > 0){
  1904 + sin.setjName(y.getJname());
2017 }else{ 1905 }else{
2018 sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); 1906 sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
2019 } 1907 }
2020 sin.setSgh(""); 1908 sin.setSgh("");
2021 sin.setsName(""); 1909 sin.setsName("");
2022 sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); 1910 sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
2023 - sin.setHyl(df.format(y.getHd()));  
2024 - sin.setJzl(df.format(y.getCdl()));  
2025 - sin.setUnyyyl(df.format(y.getSh())); 1911 + sin.setHyl(Arith.round(y.getHd(), 3) + "");
  1912 + sin.setJzl(Arith.round(y.getCdl(), 3) + "");
  1913 + sin.setUnyyyl(Arith.round(y.getSh(), 3) + "");
2026 listD.add(sin); 1914 listD.add(sin);
2027 } 1915 }
2028 } 1916 }
@@ -2032,24 +1920,29 @@ public class FormsServiceImpl implements FormsService { @@ -2032,24 +1920,29 @@ public class FormsServiceImpl implements FormsService {
2032 list.addAll(listY); 1920 list.addAll(listY);
2033 list.addAll(listD); 1921 list.addAll(listD);
2034 }else{ 1922 }else{
  1923 + List<String> objList = new ArrayList<String>();
2035 String sql="select r.s_gh,r.s_name, " 1924 String sql="select r.s_gh,r.s_name, "
2036 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,r.xl_name" 1925 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,r.xl_name"
2037 + " from bsth_c_s_sp_info_real r where " 1926 + " from bsth_c_s_sp_info_real r where "
2038 - + " r.schedule_date_str = '"+startDate+"'"  
2039 - + " and r.s_gh !='' and r.s_gh is not null "; 1927 + + " r.schedule_date_str = ? "
  1928 + + " and r.s_gh !='' and r.s_gh is not null ";
  1929 + objList.add(startDate);
2040 if(!xlbm.equals("")){ 1930 if(!xlbm.equals("")){
2041 - sql += " and r.xl_bm = '"+xlbm+"'"; 1931 + sql += " and r.xl_bm = ? ";
  1932 + objList.add(xlbm);
2042 } 1933 }
2043 if(!gsdm.equals("")){ 1934 if(!gsdm.equals("")){
2044 - sql += " and r.gs_bm='"+gsdm+"'"; 1935 + sql += " and r.gs_bm = ? ";
  1936 + objList.add(gsdm);
2045 } 1937 }
2046 if(!fgsdm.equals("")){ 1938 if(!fgsdm.equals("")){
2047 - sql += " and r.fgs_bm='"+fgsdm+"'"; 1939 + sql += " and r.fgs_bm = ? ";
  1940 + objList.add(fgsdm);
2048 } 1941 }
2049 sql += " group by r.s_gh,r.s_name," 1942 sql += " group by r.s_gh,r.s_name,"
2050 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,r.xl_name order by r.xl_bm,r.cl_zbh"; 1943 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,r.xl_name order by r.xl_bm,r.cl_zbh";
2051 1944
2052 - list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { 1945 + list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Singledata>() {
2053 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 1946 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
2054 @Override 1947 @Override
2055 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { 1948 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
@@ -2145,7 +2038,6 @@ public class FormsServiceImpl implements FormsService { @@ -2145,7 +2038,6 @@ public class FormsServiceImpl implements FormsService {
2145 List<Singledata> listD=new ArrayList<Singledata>(); 2038 List<Singledata> listD=new ArrayList<Singledata>();
2146 2039
2147 if(tjtype.equals("jsy")){ 2040 if(tjtype.equals("jsy")){
2148 - DecimalFormat df = new DecimalFormat("0.00");  
2149 List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm"); 2041 List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm");
2150 for (int i = 0; i < listYlb.size(); i++) { 2042 for (int i = 0; i < listYlb.size(); i++) {
2151 Ylb y=listYlb.get(i); 2043 Ylb y=listYlb.get(i);
@@ -2217,15 +2109,17 @@ public class FormsServiceImpl implements FormsService { @@ -2217,15 +2109,17 @@ public class FormsServiceImpl implements FormsService {
2217 sin.setrQ(startDate); 2109 sin.setrQ(startDate);
2218 if(newList.size()>0){ 2110 if(newList.size()>0){
2219 sin.setjName(newList.get(0).getjName()); 2111 sin.setjName(newList.get(0).getjName());
  2112 + }if(y.getJname()!=null && y.getJname().length() > 0){
  2113 + sin.setjName(y.getJname());
2220 }else{ 2114 }else{
2221 sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); 2115 sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
2222 } 2116 }
2223 sin.setSgh(""); 2117 sin.setSgh("");
2224 sin.setsName(""); 2118 sin.setsName("");
2225 sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); 2119 sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
2226 - sin.setHyl(df.format(y.getYh()));  
2227 - sin.setJzl(df.format(y.getJzl()));  
2228 - sin.setUnyyyl(df.format(y.getSh())); 2120 + sin.setHyl(Arith.round(y.getYh(), 2)+"");
  2121 + sin.setJzl(Arith.round(y.getJzl(), 2)+"");
  2122 + sin.setUnyyyl(Arith.round(y.getSh(), 2)+"");
2229 listY.add(sin); 2123 listY.add(sin);
2230 } 2124 }
2231 2125
@@ -2303,15 +2197,17 @@ public class FormsServiceImpl implements FormsService { @@ -2303,15 +2197,17 @@ public class FormsServiceImpl implements FormsService {
2303 sin.setrQ(startDate); 2197 sin.setrQ(startDate);
2304 if(newList.size()>0){ 2198 if(newList.size()>0){
2305 sin.setjName(newList.get(0).getjName()); 2199 sin.setjName(newList.get(0).getjName());
  2200 + }if(y.getJname()!=null && y.getJname().length() > 0){
  2201 + sin.setjName(y.getJname());
2306 }else{ 2202 }else{
2307 sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); 2203 sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
2308 } 2204 }
2309 sin.setSgh(""); 2205 sin.setSgh("");
2310 sin.setsName(""); 2206 sin.setsName("");
2311 sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); 2207 sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
2312 - sin.setHyl(df.format(y.getHd()));  
2313 - sin.setJzl(df.format(y.getCdl()));  
2314 - sin.setUnyyyl(df.format(y.getSh())); 2208 + sin.setHyl(Arith.round(y.getHd(), 3) + "");
  2209 + sin.setJzl(Arith.round(y.getCdl(), 3) + "");
  2210 + sin.setUnyyyl(Arith.round(y.getSh(), 3) + "");
2315 listD.add(sin); 2211 listD.add(sin);
2316 } 2212 }
2317 } 2213 }
@@ -2321,24 +2217,29 @@ public class FormsServiceImpl implements FormsService { @@ -2321,24 +2217,29 @@ public class FormsServiceImpl implements FormsService {
2321 list.addAll(listY); 2217 list.addAll(listY);
2322 list.addAll(listD); 2218 list.addAll(listD);
2323 }else{ 2219 }else{
  2220 + List<String> objList = new ArrayList<String>();
2324 String sql="select r.s_gh,r.s_name, " 2221 String sql="select r.s_gh,r.s_name, "
2325 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,r.xl_name" 2222 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,r.xl_name"
2326 + " from bsth_c_s_sp_info_real r where " 2223 + " from bsth_c_s_sp_info_real r where "
2327 - + " r.schedule_date_str = '"+startDate+"'" 2224 + + " r.schedule_date_str = ? "
2328 + " and r.s_gh !='' and r.s_gh is not null "; 2225 + " and r.s_gh !='' and r.s_gh is not null ";
  2226 + objList.add(startDate);
2329 if(!xlbm.equals("")){ 2227 if(!xlbm.equals("")){
2330 - sql += " and r.xl_bm = '"+xlbm+"'"; 2228 + sql += " and r.xl_bm = ? ";
  2229 + objList.add(xlbm);
2331 } 2230 }
2332 if(!gsdm.equals("")){ 2231 if(!gsdm.equals("")){
2333 - sql += " and r.gs_bm='"+gsdm+"'"; 2232 + sql += " and r.gs_bm = ? ";
  2233 + objList.add(gsdm);
2334 } 2234 }
2335 if(!fgsdm.equals("")){ 2235 if(!fgsdm.equals("")){
2336 - sql += " and r.fgs_bm='"+fgsdm+"'"; 2236 + sql += " and r.fgs_bm = ? ";
  2237 + objList.add(fgsdm);
2337 } 2238 }
2338 sql += " group by r.s_gh,r.s_name," 2239 sql += " group by r.s_gh,r.s_name,"
2339 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,xl_name order by r.xl_bm,r.cl_zbh"; 2240 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm,xl_name order by r.xl_bm,r.cl_zbh";
2340 2241
2341 - list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { 2242 + list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Singledata>() {
2342 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 2243 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
2343 @Override 2244 @Override
2344 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { 2245 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
@@ -2426,24 +2327,28 @@ public class FormsServiceImpl implements FormsService { @@ -2426,24 +2327,28 @@ public class FormsServiceImpl implements FormsService {
2426 String startDate=map.get("startDate").toString(); 2327 String startDate=map.get("startDate").toString();
2427 String endDate =map.get("endDate").toString(); 2328 String endDate =map.get("endDate").toString();
2428 2329
  2330 + List<String> objList = new ArrayList<String>();
2429 String sql="select r.xl_bm, r.gs_bm, r.fgs_bm" 2331 String sql="select r.xl_bm, r.gs_bm, r.fgs_bm"
2430 + " from bsth_c_s_sp_info_real r where" 2332 + " from bsth_c_s_sp_info_real r where"
2431 - + " r.schedule_date_str BETWEEN '"+startDate+"' and '"+endDate+"'"; 2333 + + " r.schedule_date_str BETWEEN ? and ? ";
  2334 + objList.add(startDate);
  2335 + objList.add(endDate);
2432 if(xlbm.length() != 0){ 2336 if(xlbm.length() != 0){
2433 - sql += " and r.xl_bm = '"+xlbm+"'"; 2337 + sql += " and r.xl_bm = ? ";
  2338 + objList.add(xlbm);
2434 } 2339 }
2435 if(gsdm.length() != 0){ 2340 if(gsdm.length() != 0){
2436 - sql += " and r.gs_bm='"+gsdm+"'"; 2341 + sql += " and r.gs_bm = ? ";
  2342 + objList.add(gsdm);
2437 } 2343 }
2438 if(fgsdm.length() != 0){ 2344 if(fgsdm.length() != 0){
2439 - sql += " and r.fgs_bm='"+fgsdm+"'"; 2345 + sql += " and r.fgs_bm = ? ";
  2346 + objList.add(fgsdm);
2440 } 2347 }
2441 sql += " group by r.gs_bm, r.fgs_bm, r.xl_bm " + 2348 sql += " group by r.gs_bm, r.fgs_bm, r.xl_bm " +
2442 "order by r.gs_bm, r.fgs_bm, r.xl_bm"; 2349 "order by r.gs_bm, r.fgs_bm, r.xl_bm";
2443 2350
2444 - System.out.println(sql);  
2445 -  
2446 - List<Operationservice> query = jdbcTemplate.query(sql, new RowMapper<Operationservice>() { 2351 + List<Operationservice> query = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Operationservice>() {
2447 @Override 2352 @Override
2448 public Operationservice mapRow(ResultSet arg0, int arg1) throws SQLException { 2353 public Operationservice mapRow(ResultSet arg0, int arg1) throws SQLException {
2449 Operationservice ve = new Operationservice(); 2354 Operationservice ve = new Operationservice();
@@ -2477,17 +2382,23 @@ public class FormsServiceImpl implements FormsService { @@ -2477,17 +2382,23 @@ public class FormsServiceImpl implements FormsService {
2477 } 2382 }
2478 } 2383 }
2479 2384
2480 - String ylbSql=" select * from bsth_c_ylb where rq BETWEEN '"+startDate+"' and '"+endDate+"'"; 2385 + List<String> ylbObjList = new ArrayList<String>();
  2386 + String ylbSql=" select * from bsth_c_ylb where rq BETWEEN ? and ? ";
  2387 + ylbObjList.add(startDate);
  2388 + ylbObjList.add(endDate);
2481 if(!xlbm.equals("")){ 2389 if(!xlbm.equals("")){
2482 - ylbSql += " and xlbm = '"+xlbm+"'"; 2390 + ylbSql += " and xlbm = ? ";
  2391 + ylbObjList.add(xlbm);
2483 } 2392 }
2484 if(!gsdm.equals("")){ 2393 if(!gsdm.equals("")){
2485 - ylbSql += " and ssgsdm='"+gsdm+"'"; 2394 + ylbSql += " and ssgsdm = ? ";
  2395 + ylbObjList.add(gsdm);
2486 } 2396 }
2487 if(!fgsdm.equals("")){ 2397 if(!fgsdm.equals("")){
2488 - ylbSql += " and fgsdm='"+fgsdm+"'"; 2398 + ylbSql += " and fgsdm = ? ";
  2399 + ylbObjList.add(fgsdm);
2489 } 2400 }
2490 - List<Ylb> ylbList= jdbcTemplate.query(ylbSql, new RowMapper<Ylb>() { 2401 + List<Ylb> ylbList= jdbcTemplate.query(ylbSql, ylbObjList.toArray(), new RowMapper<Ylb>() {
2491 @Override 2402 @Override
2492 public Ylb mapRow(ResultSet arg0, int arg1) throws SQLException { 2403 public Ylb mapRow(ResultSet arg0, int arg1) throws SQLException {
2493 Ylb y = new Ylb(); 2404 Ylb y = new Ylb();
@@ -2498,17 +2409,23 @@ public class FormsServiceImpl implements FormsService { @@ -2498,17 +2409,23 @@ public class FormsServiceImpl implements FormsService {
2498 } 2409 }
2499 }); 2410 });
2500 2411
2501 - String dlbSql=" select * from bsth_c_dlb where rq BETWEEN '"+startDate+"' and '"+endDate+"'"; 2412 + List<String> dlbObjList = new ArrayList<String>();
  2413 + String dlbSql=" select * from bsth_c_dlb where rq BETWEEN ? and ? ";
  2414 + dlbObjList.add(startDate);
  2415 + dlbObjList.add(endDate);
2502 if(!xlbm.equals("")){ 2416 if(!xlbm.equals("")){
2503 - ylbSql += " and xlbm = '"+xlbm+"'"; 2417 + ylbSql += " and xlbm = ? ";
  2418 + dlbObjList.add(xlbm);
2504 } 2419 }
2505 if(!gsdm.equals("")){ 2420 if(!gsdm.equals("")){
2506 - ylbSql += " and ssgsdm='"+gsdm+"'"; 2421 + ylbSql += " and ssgsdm = ? ";
  2422 + dlbObjList.add(gsdm);
2507 } 2423 }
2508 if(!fgsdm.equals("")){ 2424 if(!fgsdm.equals("")){
2509 - ylbSql += " and fgsdm='"+fgsdm+"'"; 2425 + ylbSql += " and fgsdm = ? ";
  2426 + dlbObjList.add(fgsdm);
2510 } 2427 }
2511 - List<Dlb> dlbList= jdbcTemplate.query(dlbSql, new RowMapper<Dlb>() { 2428 + List<Dlb> dlbList= jdbcTemplate.query(dlbSql, dlbObjList.toArray(), new RowMapper<Dlb>() {
2512 @Override 2429 @Override
2513 public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException { 2430 public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException {
2514 Dlb d = new Dlb(); 2431 Dlb d = new Dlb();
@@ -2603,13 +2520,16 @@ public class FormsServiceImpl implements FormsService { @@ -2603,13 +2520,16 @@ public class FormsServiceImpl implements FormsService {
2603 @Override 2520 @Override
2604 public List<Vehicleloading> vehicleloading(String line, String date) { 2521 public List<Vehicleloading> vehicleloading(String line, String date) {
2605 2522
  2523 + List<String> objList = new ArrayList<String>();
2606 String sql="select r.s_gh,r.s_name, " 2524 String sql="select r.s_gh,r.s_name, "
2607 - + " r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm"  
2608 - + " from bsth_c_s_sp_info_real r where r.schedule_date_str = '"+date+"' "  
2609 - + " and r.xl_bm = '"+line+"' group by r.s_gh,r.s_name,"  
2610 - + " r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm"; 2525 + + " r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.gs_bm,r.fgs_bm"
  2526 + + " from bsth_c_s_sp_info_real r where r.schedule_date_str = ? "
  2527 + + " and r.xl_bm = ? group by r.s_gh,r.s_name,"
  2528 + + " r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.gs_bm,r.fgs_bm";
  2529 + objList.add(date);
  2530 + objList.add(line);
2611 2531
2612 - List<Vehicleloading> list = jdbcTemplate.query(sql, new RowMapper<Vehicleloading>() { 2532 + List<Vehicleloading> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Vehicleloading>() {
2613 @Override 2533 @Override
2614 public Vehicleloading mapRow(ResultSet arg0, int arg1) throws SQLException { 2534 public Vehicleloading mapRow(ResultSet arg0, int arg1) throws SQLException {
2615 Vehicleloading ve = new Vehicleloading(); 2535 Vehicleloading ve = new Vehicleloading();
@@ -2680,10 +2600,10 @@ public class FormsServiceImpl implements FormsService { @@ -2680,10 +2600,10 @@ public class FormsServiceImpl implements FormsService {
2680 fyy=Arith.add(fyy, d.getSh()==null?0:d.getSh()); 2600 fyy=Arith.add(fyy, d.getSh()==null?0:d.getSh());
2681 } 2601 }
2682 } 2602 }
2683 - sin.setHyl(String.valueOf(yhl));  
2684 - sin.setJzl(String.valueOf(jzl));  
2685 - sin.setUnyyyl(String.valueOf(fyy));  
2686 - sin.setLs(String.valueOf(ns)); 2603 + sin.setHyl(Arith.round(yhl, 3) + "");
  2604 + sin.setJzl(Arith.round(jzl, 3) + "");
  2605 + sin.setUnyyyl(Arith.round(fyy, 3) + "");
  2606 + sin.setLs(Arith.round(ns, 3) + "");
2687 } 2607 }
2688 return list; 2608 return list;
2689 } 2609 }
@@ -2729,19 +2649,24 @@ public class FormsServiceImpl implements FormsService { @@ -2729,19 +2649,24 @@ public class FormsServiceImpl implements FormsService {
2729 List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, startDate, endDate, company, subCompany); 2649 List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, startDate, endDate, company, subCompany);
2730 List<Line> lineList = lineRepository.findLineBygsBm(company, subCompany, line.length()==0?"%"+line+"%":line); 2650 List<Line> lineList = lineRepository.findLineBygsBm(company, subCompany, line.length()==0?"%"+line+"%":line);
2731 2651
  2652 + List<String> objList = new ArrayList<String>();
2732 String sql = "select gs_name, fgs_name, cl_zbh, fcsj, bc_type, xl_bm, xl_name, schedule_date" 2653 String sql = "select gs_name, fgs_name, cl_zbh, fcsj, bc_type, xl_bm, xl_name, schedule_date"
2733 - + " from bsth_c_s_sp_info where "  
2734 - + "schedule_date >= '"+startDate+"' and schedule_date <= '"+endDate+"' "; 2654 + + " from bsth_c_s_sp_info where schedule_date >= ? and schedule_date <= ? ";
  2655 + objList.add(startDate);
  2656 + objList.add(endDate);
2735 if(line.trim().length() != 0){ 2657 if(line.trim().length() != 0){
2736 - sql += "and xl_bm = '"+line+"' "; 2658 + sql += "and xl_bm = ? ";
  2659 + objList.add(line);
2737 } 2660 }
2738 if(company.trim().length() != 0){ 2661 if(company.trim().length() != 0){
2739 - sql += "and gs_bm = '"+company+"' "; 2662 + sql += "and gs_bm = ? ";
  2663 + objList.add(company);
2740 } 2664 }
2741 if(subCompany.trim().length() != 0){ 2665 if(subCompany.trim().length() != 0){
2742 - sql += "and fgs_bm = '"+subCompany+"' "; 2666 + sql += "and fgs_bm = ? ";
  2667 + objList.add(subCompany);
2743 } 2668 }
2744 - List<SchedulePlanInfo> planList = jdbcTemplate.query(sql, new RowMapper<SchedulePlanInfo>() { 2669 + List<SchedulePlanInfo> planList = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<SchedulePlanInfo>() {
2745 2670
2746 @Override 2671 @Override
2747 public SchedulePlanInfo mapRow(ResultSet arg0, int arg1) throws SQLException { 2672 public SchedulePlanInfo mapRow(ResultSet arg0, int arg1) throws SQLException {
@@ -2900,32 +2825,36 @@ public class FormsServiceImpl implements FormsService { @@ -2900,32 +2825,36 @@ public class FormsServiceImpl implements FormsService {
2900 String rq3 = sdf1.format(d1); 2825 String rq3 = sdf1.format(d1);
2901 2826
2902 rq = rq2 + "-" + rq3; 2827 rq = rq2 + "-" + rq3;
2903 -  
2904 - String where = "";  
2905 - if(gsbm.trim().length() != 0){  
2906 - where += " and gs_bm = '" + gsbm + "'";  
2907 - }  
2908 - if(fgsbm.trim().length() != 0){  
2909 - where += " and fgs_bm = '" + fgsbm + "'";  
2910 - }  
2911 2828
  2829 + List<String> objList = new ArrayList<String>();
2912 String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,a.bc_type from " 2830 String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,a.bc_type from "
2913 + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl,bc_type" 2831 + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl,bc_type"
2914 - + " from bsth_c_s_sp_info" + " where schedule_date >= '"  
2915 - + map.get("startDate").toString() + "' and schedule_date <= '" + map.get("endDate").toString() + "' and xl_bm='"  
2916 - + map.get("line").toString() + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out')"  
2917 - + where  
2918 -// + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type "  
2919 - + " ) a left JOIN ("  
2920 - + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl "  
2921 - + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl,bc_type from bsth_c_s_sp_info_real "  
2922 - + "where schedule_date_str >= '" + map.get("startDate").toString() + "' and schedule_date_str <= '"  
2923 - + map.get("endDate").toString() + "' and xl_bm='" + map.get("line").toString()  
2924 - + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out') "  
2925 -// + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type" 2832 + + " from bsth_c_s_sp_info where schedule_date >= ? and schedule_date <= ? "
  2833 + + " and xl_bm = ? AND gs_bm is not null AND bc_type NOT IN ('in', 'out') ";
  2834 + objList.add(map.get("startDate").toString());
  2835 + objList.add(map.get("endDate").toString());
  2836 + objList.add(map.get("line").toString());
  2837 + if(gsbm.trim().length() != 0){
  2838 + sql += " and gs_bm = ? ";
  2839 + objList.add(gsbm);
  2840 + }
  2841 + if(fgsbm.trim().length() != 0){
  2842 + sql += " and fgs_bm = ? ";
  2843 + objList.add(fgsbm);
  2844 + }
  2845 + sql += " ) a left JOIN ("
  2846 + + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl "
  2847 + + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, "
  2848 + + " count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl,bc_type from bsth_c_s_sp_info_real "
  2849 + + " where schedule_date_str >= ? and schedule_date_str <= ? and xl_bm = ? "
  2850 + + " AND gs_bm is not null AND bc_type NOT IN ('in', 'out') "
2926 + " ) b ON t.company=b.gs_bm and t.branche_company = b.fgs_bm) b on " 2851 + " ) b ON t.company=b.gs_bm and t.branche_company = b.fgs_bm) b on "
2927 - + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm ";  
2928 - List<Executionrate> list = jdbcTemplate.query(sql, new RowMapper<Executionrate>() { 2852 + + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm ";
  2853 + objList.add(map.get("startDate").toString());
  2854 + objList.add(map.get("endDate").toString());
  2855 + objList.add(map.get("line").toString());
  2856 +
  2857 + List<Executionrate> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Executionrate>() {
2929 2858
2930 @Override 2859 @Override
2931 public Executionrate mapRow(ResultSet arg0, int arg1) throws SQLException { 2860 public Executionrate mapRow(ResultSet arg0, int arg1) throws SQLException {
@@ -2992,27 +2921,29 @@ public class FormsServiceImpl implements FormsService { @@ -2992,27 +2921,29 @@ public class FormsServiceImpl implements FormsService {
2992 2921
2993 rq = rq2 + "-" + rq3; 2922 rq = rq2 + "-" + rq3;
2994 2923
2995 - String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,a.bc_type from "  
2996 - + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl,bc_type"  
2997 - + " from bsth_c_s_sp_info" + " where schedule_date >= '"  
2998 - + map.get("startDate").toString() + "' and schedule_date <='" + map.get("endDate").toString() + "' and xl_bm='"  
2999 - + map.get("line").toString() + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out') "  
3000 - + " and gs_bm='"+ map.get("gsdmAllline").toString() + "'"  
3001 - + " and fgs_bm='"+ map.get("fgsdmAllline").toString() + "'"  
3002 -// + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type "  
3003 - + " ) a left JOIN ("  
3004 - + "SELECT COUNT(*"  
3005 - + ") as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b."  
3006 - + "xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl "  
3007 - + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl,bc_type from bsth_c_s_sp_info_real "  
3008 - + "where schedule_date_str >= '" + map.get("startDate").toString() + "' and schedule_date_str <= '"  
3009 - + map.get("endDate").toString() + "' and xl_bm='" + map.get  
3010 - ("line").toString()  
3011 - + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out')"  
3012 -// + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type"  
3013 - + " ) b ON t.company=b.gs_bm and t.branche_company = b.fgs_bm) b on "  
3014 - + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm ";  
3015 - List<Allline> list = jdbcTemplate.query(sql, new RowMapper<Allline>() { 2924 + List<String> objList = new ArrayList<String>();
  2925 + String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name, a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc,a.jxl,a.jcl,a.gslsbm,a.fgsbm,a.bc_type from "
  2926 + + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl,COUNT(DISTINCT cl_zbh) as jcl,bc_type"
  2927 + + " from bsth_c_s_sp_info where schedule_date >= ? and schedule_date <= ? and xl_bm = ? "
  2928 + + " AND gs_bm is not null AND bc_type NOT IN ('in', 'out') "
  2929 + + " and gs_bm = ? and fgs_bm = ? "
  2930 + + " ) a left JOIN ( "
  2931 + + " SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name,b.sbc,b.sxl,b.scl "
  2932 + + " from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl,COUNT(DISTINCT cl_zbh) as scl,bc_type from bsth_c_s_sp_info_real "
  2933 + + " where schedule_date_str >= ? and schedule_date_str <= ? and xl_bm = ? "
  2934 + + " AND gs_bm is not null AND bc_type NOT IN ('in', 'out') "
  2935 + + " ) b ON t.company=b.gs_bm and t.branche_company = b.fgs_bm) b on "
  2936 + + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm ";
  2937 + objList.add(map.get("startDate").toString());
  2938 + objList.add(map.get("endDate").toString());
  2939 + objList.add(map.get("line").toString());
  2940 + objList.add(map.get("gsdmAllline").toString());
  2941 + objList.add(map.get("fgsdmAllline").toString());
  2942 + objList.add(map.get("startDate").toString());
  2943 + objList.add(map.get("endDate").toString());
  2944 + objList.add(map.get("line").toString());
  2945 +
  2946 + List<Allline> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Allline>() {
3016 2947
3017 @Override 2948 @Override
3018 public Allline mapRow(ResultSet arg0, int arg1) throws SQLException { 2949 public Allline mapRow(ResultSet arg0, int arg1) throws SQLException {
@@ -3070,47 +3001,36 @@ public class FormsServiceImpl implements FormsService { @@ -3070,47 +3001,36 @@ public class FormsServiceImpl implements FormsService {
3070 if(map.get("fgsdmDaily")!=null){ 3001 if(map.get("fgsdmDaily")!=null){
3071 fgsbm=map.get("fgsdmDaily").toString(); 3002 fgsbm=map.get("fgsdmDaily").toString();
3072 } 3003 }
3073 -  
3074 - /*String sql="select t.schedule_date_str,"  
3075 - + " t.cl_zbh,t.j_gh,t.j_name,x.yh from (select r.schedule_date_str,r.xl_bm,"  
3076 - + " r.cl_zbh,r.j_gh,r.j_name from bsth_c_s_sp_info_real r WHERE "  
3077 - + " r.xl_bm='" + map.get("line").toString() + "' "  
3078 - + " and to_days(r.schedule_date)=to_days('"+map.get("date").toString()+"') "  
3079 - + " and r.gs_bm like '%"+gsbm+"%' "  
3080 - + " and r.fgs_bm like '%"+fgsbm+"%' "  
3081 - + " GROUP BY r.schedule_date_str,r.xl_bm,r.cl_zbh,r.j_gh,r.j_name) t"  
3082 - + " left join (select * from bsth_c_ylb y where "  
3083 - + " to_days(y.rq)=to_days('"+map.get("date").toString()+"') "  
3084 - + " and y.xlbm= '" + map.get("line").toString() + "'"  
3085 - + " and y.ssgsdm like '%"+gsbm+"%' "  
3086 - + " and y.fgsdm like '%"+fgsbm+"%'"  
3087 - + " ) x"  
3088 - + " on t.cl_zbh = x.nbbm and t.j_gh=x.jsy";*/  
3089 3004
  3005 + List<String> objList = new ArrayList<String>();
3090 String sql="select r.schedule_date_str, " 3006 String sql="select r.schedule_date_str, "
3091 - + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm" 3007 + + " r.xl_bm,r.cl_zbh,r.j_gh,r.gs_bm,r.fgs_bm "
3092 + " from bsth_c_s_sp_info_real r where " 3008 + " from bsth_c_s_sp_info_real r where "
3093 - + "r.schedule_date_str = '"+map.get("date").toString()+"'"; 3009 + + " r.schedule_date_str = ? ";
  3010 + objList.add(map.get("date").toString());
3094 if(!xlbm.equals("")){ 3011 if(!xlbm.equals("")){
3095 - sql += " and r.xl_bm = '"+xlbm+"'"; 3012 + sql += " and r.xl_bm = ? ";
  3013 + objList.add(xlbm);
3096 } 3014 }
3097 if(!gsbm.equals("")){ 3015 if(!gsbm.equals("")){
3098 - sql += " and r.gs_bm='"+gsbm+"'"; 3016 + sql += " and r.gs_bm = ? ";
  3017 + objList.add(gsbm);
3099 } 3018 }
3100 if(!fgsbm.equals("")){ 3019 if(!fgsbm.equals("")){
3101 - sql += " and r.fgs_bm='"+fgsbm+"'"; 3020 + sql += " and r.fgs_bm = ? ";
  3021 + objList.add(fgsbm);
3102 } 3022 }
3103 - sql += " group by r.schedule_date_str,"  
3104 - + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; 3023 + sql += " group by r.schedule_date_str,"
  3024 + + " r.xl_bm,r.cl_zbh,r.j_gh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";
3105 3025
3106 - List<Daily> list = jdbcTemplate.query(sql, new RowMapper<Daily>() { 3026 + List<Daily> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Daily>() {
3107 @Override 3027 @Override
3108 public Daily mapRow(ResultSet arg0, int arg1) throws SQLException { 3028 public Daily mapRow(ResultSet arg0, int arg1) throws SQLException {
3109 Daily daily = new Daily(); 3029 Daily daily = new Daily();
3110 daily.setRq(arg0.getString("schedule_date_str")); 3030 daily.setRq(arg0.getString("schedule_date_str"));
3111 daily.setZbh(arg0.getString("cl_zbh")); 3031 daily.setZbh(arg0.getString("cl_zbh"));
3112 daily.setJgh(arg0.getString("j_gh")); 3032 daily.setJgh(arg0.getString("j_gh"));
3113 - daily.setjName(arg0.getString("j_name")); 3033 +// daily.setjName(arg0.getString("j_name"));
3114 return daily; 3034 return daily;
3115 } 3035 }
3116 }); 3036 });
@@ -3135,19 +3055,23 @@ public class FormsServiceImpl implements FormsService { @@ -3135,19 +3055,23 @@ public class FormsServiceImpl implements FormsService {
3135 yh=Arith.add(yh, b.getHd()); 3055 yh=Arith.add(yh, b.getHd());
3136 } 3056 }
3137 } 3057 }
3138 - d.setYh(String.valueOf(yh)); 3058 + d.setYh(Arith.round(yh, 3) + "");
3139 for (int j = 0; j < lists.size(); j++) { 3059 for (int j = 0; j < lists.size(); j++) {
3140 ScheduleRealInfo s=lists.get(j); 3060 ScheduleRealInfo s=lists.get(j);
3141 if(d.getJgh().equals(s.getjGh()) && d.getZbh().equals(s.getClZbh())){ 3061 if(d.getJgh().equals(s.getjGh()) && d.getZbh().equals(s.getClZbh())){
3142 - Set<ChildTaskPlan> cts = s.getcTasks();  
3143 - if(cts != null && cts.size() > 0){ 3062 + Set<ChildTaskPlan> cts = s.getcTasks();
  3063 + if(cts != null && cts.size() > 0){
  3064 + sList.add(s);
  3065 + }else{
  3066 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
3144 sList.add(s); 3067 sList.add(s);
3145 - }else{  
3146 - if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){  
3147 - sList.add(s);  
3148 - }  
3149 } 3068 }
3150 - 3069 + }
  3070 +
  3071 + if((d.getjName() == null || d.getjName().trim().length() == 0)
  3072 + && s.getjName() != null && s.getjName().length() > 0){
  3073 + d.setjName(s.getjName());
  3074 + }
3151 } 3075 }
3152 } 3076 }
3153 3077