Commit a7932481a827e604cbc357190222ecf1f1c2a757
1 parent
7a40065f
Update
Showing
4 changed files
with
66 additions
and
1 deletions
Too many changes to show.
To preserve performance only 4 of 13 files are displayed.
src/main/java/com/bsth/service/schedule/rules/ScheduleRuleServiceImpl.java
| @@ -112,6 +112,9 @@ public class ScheduleRuleServiceImpl implements ScheduleRuleService { | @@ -112,6 +112,9 @@ public class ScheduleRuleServiceImpl implements ScheduleRuleService { | ||
| 112 | public SchedulePlanRuleResult mapRow(ResultSet rs, int i) throws SQLException { | 112 | public SchedulePlanRuleResult mapRow(ResultSet rs, int i) throws SQLException { |
| 113 | SchedulePlanRuleResult obj = new SchedulePlanRuleResult(); | 113 | SchedulePlanRuleResult obj = new SchedulePlanRuleResult(); |
| 114 | obj.setRuleId(rs.getString("rule_id")); | 114 | obj.setRuleId(rs.getString("rule_id")); |
| 115 | + obj.setCcZbh(rs.getString("cc_zbh")); | ||
| 116 | + obj.setGids(rs.getString("gids")); | ||
| 117 | + obj.setEcids(rs.getString("ecids")); | ||
| 115 | obj.setScheduleDate(rs.getDate("schedule_date")); | 118 | obj.setScheduleDate(rs.getDate("schedule_date")); |
| 116 | obj.setGidindex(rs.getString("gidindex")); | 119 | obj.setGidindex(rs.getString("gidindex")); |
| 117 | obj.setEcindex(rs.getString("ecindex")); | 120 | obj.setEcindex(rs.getString("ecindex")); |
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleRule_input.java
| 1 | package com.bsth.service.schedule.rules.shiftloop; | 1 | package com.bsth.service.schedule.rules.shiftloop; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; | 3 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; |
| 4 | +import com.bsth.service.schedule.utils.Md5Util; | ||
| 4 | import com.google.common.base.Splitter; | 5 | import com.google.common.base.Splitter; |
| 5 | import org.apache.commons.lang3.StringUtils; | 6 | import org.apache.commons.lang3.StringUtils; |
| 6 | import org.joda.time.DateTime; | 7 | import org.joda.time.DateTime; |
| @@ -17,6 +18,12 @@ public class ScheduleRule_input { | @@ -17,6 +18,12 @@ public class ScheduleRule_input { | ||
| 17 | 18 | ||
| 18 | /** 规则Id */ | 19 | /** 规则Id */ |
| 19 | private String ruleId; | 20 | private String ruleId; |
| 21 | + /** | ||
| 22 | + * 规则md5值(不使用id判定,使用md5判定) | ||
| 23 | + * 使用,启用日期,路牌范围,人员范围 结合生成md5编码 | ||
| 24 | + */ | ||
| 25 | + private String ruleMd5; | ||
| 26 | + | ||
| 20 | /** 规则启用日期 */ | 27 | /** 规则启用日期 */ |
| 21 | private DateTime qyrq; | 28 | private DateTime qyrq; |
| 22 | 29 | ||
| @@ -78,9 +85,20 @@ public class ScheduleRule_input { | @@ -78,9 +85,20 @@ public class ScheduleRule_input { | ||
| 78 | } | 85 | } |
| 79 | } | 86 | } |
| 80 | 87 | ||
| 88 | + /** 生成规则md5编码 */ | ||
| 89 | + ruleMd5 = Md5Util.getMd5( | ||
| 90 | + String.valueOf(qyrq.getMillis()) + "_" + | ||
| 91 | + scheduleRule1Flat.getLpIds() + "_" + | ||
| 92 | + scheduleRule1Flat.getRyConfigIds() | ||
| 93 | + ); | ||
| 94 | + | ||
| 95 | + System.out.println("rule的md5:" + ruleMd5 + " 车辆:" + scheduleRule1Flat.getCarConfigInfo().getCl().getInsideCode()); | ||
| 96 | + | ||
| 81 | this.self = scheduleRule1Flat; | 97 | this.self = scheduleRule1Flat; |
| 82 | } | 98 | } |
| 83 | 99 | ||
| 100 | + | ||
| 101 | + | ||
| 84 | public String getRuleId() { | 102 | public String getRuleId() { |
| 85 | return ruleId; | 103 | return ruleId; |
| 86 | } | 104 | } |
| @@ -160,4 +178,12 @@ public class ScheduleRule_input { | @@ -160,4 +178,12 @@ public class ScheduleRule_input { | ||
| 160 | public void setSelf(ScheduleRule1Flat self) { | 178 | public void setSelf(ScheduleRule1Flat self) { |
| 161 | this.self = self; | 179 | this.self = self; |
| 162 | } | 180 | } |
| 181 | + | ||
| 182 | + public String getRuleMd5() { | ||
| 183 | + return ruleMd5; | ||
| 184 | + } | ||
| 185 | + | ||
| 186 | + public void setRuleMd5(String ruleMd5) { | ||
| 187 | + this.ruleMd5 = ruleMd5; | ||
| 188 | + } | ||
| 163 | } | 189 | } |
src/main/java/com/bsth/service/schedule/utils/Md5Util.java
0 → 100644
| 1 | +package com.bsth.service.schedule.utils; | ||
| 2 | + | ||
| 3 | +import java.security.MessageDigest; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Md5工具。 | ||
| 7 | + */ | ||
| 8 | +public class Md5Util { | ||
| 9 | + private static MessageDigest md5 = null; | ||
| 10 | + static { | ||
| 11 | + try { | ||
| 12 | + md5 = MessageDigest.getInstance("MD5"); | ||
| 13 | + } catch (Exception exp) { | ||
| 14 | + exp.printStackTrace(); | ||
| 15 | + } | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 用于获取一个String的md5值。 | ||
| 20 | + * @param str | ||
| 21 | + * @return | ||
| 22 | + */ | ||
| 23 | + public static String getMd5(String str) { | ||
| 24 | + byte[] bs = md5.digest(str.getBytes()); | ||
| 25 | + StringBuilder s = new StringBuilder(); | ||
| 26 | + for (byte x : bs) { | ||
| 27 | + if ((x & 0xff) >>4 == 0) { | ||
| 28 | + s.append("0").append(Integer.toHexString(x & 0xff)); | ||
| 29 | + } else { | ||
| 30 | + s.append(Integer.toHexString(x & 0xff)); | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + return s.toString(); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | +} |
src/main/resources/application-dev.properties
| @@ -10,7 +10,7 @@ spring.jpa.show-sql= true | @@ -10,7 +10,7 @@ spring.jpa.show-sql= true | ||
| 10 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver | 10 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver |
| 11 | spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false | 11 | spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false |
| 12 | spring.datasource.username= root | 12 | spring.datasource.username= root |
| 13 | -spring.datasource.password= root | 13 | +spring.datasource.password= |
| 14 | #spring.datasource.url= jdbc:mysql://192.168.168.117/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | 14 | #spring.datasource.url= jdbc:mysql://192.168.168.117/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false |
| 15 | #spring.datasource.username= root | 15 | #spring.datasource.username= root |
| 16 | #spring.datasource.password= root | 16 | #spring.datasource.password= root |