Commit 2f2deba0803ef32ee7cf96126b5aac7cdb84b05e

Authored by 潘钊
1 parent f1529067

update...

src/main/java/com/bsth/server_rs/schedule/dto/AttendancePlanDay.java
@@ -9,6 +9,10 @@ public class AttendancePlanDay { @@ -9,6 +9,10 @@ public class AttendancePlanDay {
9 9
10 private String jName; 10 private String jName;
11 11
  12 + private String sGh;
  13 +
  14 + private String sName;
  15 +
12 private String scheduleDate; 16 private String scheduleDate;
13 17
14 public String getjGh() { 18 public String getjGh() {
@@ -34,4 +38,20 @@ public class AttendancePlanDay { @@ -34,4 +38,20 @@ public class AttendancePlanDay {
34 public void setScheduleDate(String scheduleDate) { 38 public void setScheduleDate(String scheduleDate) {
35 this.scheduleDate = scheduleDate; 39 this.scheduleDate = scheduleDate;
36 } 40 }
  41 +
  42 + public String getsGh() {
  43 + return sGh;
  44 + }
  45 +
  46 + public void setsGh(String sGh) {
  47 + this.sGh = sGh;
  48 + }
  49 +
  50 + public String getsName() {
  51 + return sName;
  52 + }
  53 +
  54 + public void setsName(String sName) {
  55 + this.sName = sName;
  56 + }
37 } 57 }
src/main/java/com/bsth/server_rs/schedule/dto/AttendancePlanMonth.java
@@ -2,6 +2,7 @@ package com.bsth.server_rs.schedule.dto; @@ -2,6 +2,7 @@ package com.bsth.server_rs.schedule.dto;
2 2
3 import com.bsth.util.ConvertUtil; 3 import com.bsth.util.ConvertUtil;
4 import com.google.common.collect.ArrayListMultimap; 4 import com.google.common.collect.ArrayListMultimap;
  5 +import org.apache.commons.lang3.StringUtils;
5 import org.slf4j.Logger; 6 import org.slf4j.Logger;
6 import org.slf4j.LoggerFactory; 7 import org.slf4j.LoggerFactory;
7 8
@@ -23,16 +24,27 @@ public class AttendancePlanMonth { @@ -23,16 +24,27 @@ public class AttendancePlanMonth {
23 if(list == null || list.size() == 0) 24 if(list == null || list.size() == 0)
24 return rs; 25 return rs;
25 26
26 - //分组  
27 Class clazz = AttendancePlanDay.class; 27 Class clazz = AttendancePlanDay.class;
28 try { 28 try {
29 - ArrayListMultimap<String, AttendancePlanDay> listMultimap = new ConvertUtil<AttendancePlanDay>() 29 + //驾驶员分组
  30 + ArrayListMultimap<String, AttendancePlanDay> jsyMultimap = new ConvertUtil<AttendancePlanDay>()
30 .groupMultiList(list, "/", clazz.getDeclaredField("jGh"), clazz.getDeclaredField("jName")); 31 .groupMultiList(list, "/", clazz.getDeclaredField("jGh"), clazz.getDeclaredField("jName"));
31 32
32 - Set<String> ks = listMultimap.keySet(); 33 + Set<String> ks = jsyMultimap.keySet();
33 34
34 for(String k : ks){ 35 for(String k : ks){
35 - rs.add(new AttendancePlanMonth(month, k, listMultimap.get(k))); 36 + rs.add(new AttendancePlanMonth(month, k, jsyMultimap.get(k)));
  37 + }
  38 +
  39 + //售票员分组
  40 + ArrayListMultimap<String, AttendancePlanDay> spyMultimap = new ConvertUtil<AttendancePlanDay>()
  41 + .groupMultiList(list, "/", clazz.getDeclaredField("sGh"), clazz.getDeclaredField("sName"));
  42 +
  43 + ks = spyMultimap.keySet();
  44 +
  45 + for(String k : ks){
  46 + if(StringUtils.isNotEmpty(k))
  47 + rs.add(new AttendancePlanMonth(month, k, spyMultimap.get(k)));
36 } 48 }
37 } catch (NoSuchFieldException e) { 49 } catch (NoSuchFieldException e) {
38 logger.error("", e); 50 logger.error("", e);
@@ -44,7 +56,7 @@ public class AttendancePlanMonth { @@ -44,7 +56,7 @@ public class AttendancePlanMonth {
44 56
45 AttendancePlanMonth(String month, String jsy, List<AttendancePlanDay> list){ 57 AttendancePlanMonth(String month, String jsy, List<AttendancePlanDay> list){
46 this.month = month; 58 this.month = month;
47 - this.jsy = jsy; 59 + this.personnel = jsy;
48 this.ycqts = list.size(); 60 this.ycqts = list.size();
49 61
50 StringBuilder sb = new StringBuilder(); 62 StringBuilder sb = new StringBuilder();
@@ -62,8 +74,8 @@ public class AttendancePlanMonth { @@ -62,8 +74,8 @@ public class AttendancePlanMonth {
62 /** 月份 yyyy-MM */ 74 /** 月份 yyyy-MM */
63 private String month; 75 private String month;
64 76
65 - /** 驾驶员 */  
66 - private String jsy; 77 + /** 人员 */
  78 + private String personnel;
67 79
68 /** 出勤天数 */ 80 /** 出勤天数 */
69 private int ycqts; 81 private int ycqts;
@@ -79,14 +91,6 @@ public class AttendancePlanMonth { @@ -79,14 +91,6 @@ public class AttendancePlanMonth {
79 this.month = month; 91 this.month = month;
80 } 92 }
81 93
82 - public String getJsy() {  
83 - return jsy;  
84 - }  
85 -  
86 - public void setJsy(String jsy) {  
87 - this.jsy = jsy;  
88 - }  
89 -  
90 public int getYcqts() { 94 public int getYcqts() {
91 return ycqts; 95 return ycqts;
92 } 96 }
@@ -102,4 +106,12 @@ public class AttendancePlanMonth { @@ -102,4 +106,12 @@ public class AttendancePlanMonth {
102 public void setDetails(String details) { 106 public void setDetails(String details) {
103 this.details = details; 107 this.details = details;
104 } 108 }
  109 +
  110 + public String getPersonnel() {
  111 + return personnel;
  112 + }
  113 +
  114 + public void setPersonnel(String personnel) {
  115 + this.personnel = personnel;
  116 + }
105 } 117 }
src/main/java/com/bsth/server_rs/schedule/plan/SchedulePlanService.java
@@ -62,7 +62,7 @@ public class SchedulePlanService { @@ -62,7 +62,7 @@ public class SchedulePlanService {
62 return null; 62 return null;
63 } 63 }
64 64
65 - List<AttendancePlanDay> list = jdbcTemplate.query("SELECT j_gh,j_name,DATE_FORMAT(schedule_date,'%Y-%m-%d') as schedule_date FROM bsth_c_s_sp_info WHERE gs_bm='"+company+"' and schedule_date LIKE '"+month+"-%' GROUP BY j_gh,j_name,DATE_FORMAT(schedule_date,'%Y-%m-%d')", BeanPropertyRowMapper.newInstance(AttendancePlanDay.class)); 65 + List<AttendancePlanDay> list = jdbcTemplate.query("SELECT j_gh,j_name,s_gh,s_name,DATE_FORMAT(schedule_date,'%Y-%m-%d') as schedule_date FROM bsth_c_s_sp_info WHERE gs_bm='"+company+"' and schedule_date LIKE '"+month+"-%' GROUP BY j_gh,j_name,DATE_FORMAT(schedule_date,'%Y-%m-%d')", BeanPropertyRowMapper.newInstance(AttendancePlanDay.class));
66 return AttendancePlanMonth.getMultiInstance(month, list); 66 return AttendancePlanMonth.getMultiInstance(month, list);
67 } 67 }
68 } 68 }
src/main/java/com/bsth/util/ConvertUtil.java
@@ -37,13 +37,16 @@ public class ConvertUtil&lt;T&gt; { @@ -37,13 +37,16 @@ public class ConvertUtil&lt;T&gt; {
37 key = ""; 37 key = "";
38 for (Field f : fields) { 38 for (Field f : fields) {
39 f.setAccessible(true); 39 f.setAccessible(true);
  40 + if(null == f.get(t))
  41 + continue;
40 //日期类型格式化为 YYYY-MM-DD 42 //日期类型格式化为 YYYY-MM-DD
41 if (f.getType().equals(Date.class)) 43 if (f.getType().equals(Date.class))
42 key += (separator + fmtyyyyMMdd.print(((Date) f.get(t)).getTime())); 44 key += (separator + fmtyyyyMMdd.print(((Date) f.get(t)).getTime()));
43 else 45 else
44 key += (separator + f.get(t).toString()); 46 key += (separator + f.get(t).toString());
45 } 47 }
46 - key = key.substring(1); 48 + if(key.length() > 1)
  49 + key = key.substring(1);
47 50
48 multimap.put(key, t); 51 multimap.put(key, t);
49 } 52 }