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 9  
10 10 private String jName;
11 11  
  12 + private String sGh;
  13 +
  14 + private String sName;
  15 +
12 16 private String scheduleDate;
13 17  
14 18 public String getjGh() {
... ... @@ -34,4 +38,20 @@ public class AttendancePlanDay {
34 38 public void setScheduleDate(String scheduleDate) {
35 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 2  
3 3 import com.bsth.util.ConvertUtil;
4 4 import com.google.common.collect.ArrayListMultimap;
  5 +import org.apache.commons.lang3.StringUtils;
5 6 import org.slf4j.Logger;
6 7 import org.slf4j.LoggerFactory;
7 8  
... ... @@ -23,16 +24,27 @@ public class AttendancePlanMonth {
23 24 if(list == null || list.size() == 0)
24 25 return rs;
25 26  
26   - //分组
27 27 Class clazz = AttendancePlanDay.class;
28 28 try {
29   - ArrayListMultimap<String, AttendancePlanDay> listMultimap = new ConvertUtil<AttendancePlanDay>()
  29 + //驾驶员分组
  30 + ArrayListMultimap<String, AttendancePlanDay> jsyMultimap = new ConvertUtil<AttendancePlanDay>()
30 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 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 49 } catch (NoSuchFieldException e) {
38 50 logger.error("", e);
... ... @@ -44,7 +56,7 @@ public class AttendancePlanMonth {
44 56  
45 57 AttendancePlanMonth(String month, String jsy, List<AttendancePlanDay> list){
46 58 this.month = month;
47   - this.jsy = jsy;
  59 + this.personnel = jsy;
48 60 this.ycqts = list.size();
49 61  
50 62 StringBuilder sb = new StringBuilder();
... ... @@ -62,8 +74,8 @@ public class AttendancePlanMonth {
62 74 /** 月份 yyyy-MM */
63 75 private String month;
64 76  
65   - /** 驾驶员 */
66   - private String jsy;
  77 + /** 人员 */
  78 + private String personnel;
67 79  
68 80 /** 出勤天数 */
69 81 private int ycqts;
... ... @@ -79,14 +91,6 @@ public class AttendancePlanMonth {
79 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 94 public int getYcqts() {
91 95 return ycqts;
92 96 }
... ... @@ -102,4 +106,12 @@ public class AttendancePlanMonth {
102 106 public void setDetails(String details) {
103 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 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 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 37 key = "";
38 38 for (Field f : fields) {
39 39 f.setAccessible(true);
  40 + if(null == f.get(t))
  41 + continue;
40 42 //日期类型格式化为 YYYY-MM-DD
41 43 if (f.getType().equals(Date.class))
42 44 key += (separator + fmtyyyyMMdd.print(((Date) f.get(t)).getTime()));
43 45 else
44 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 51 multimap.put(key, t);
49 52 }
... ...