Commit 3aa7cd87a893ac2d13b6c4d545f38a5a1b4b6217
1 parent
5b999d2f
1
Showing
3 changed files
with
402 additions
and
405 deletions
src/main/java/com/bsth/entity/ChildTaskPlan.java
| 1 | -package com.bsth.entity; | |
| 2 | - | |
| 3 | -import com.fasterxml.jackson.annotation.JsonIgnore; | |
| 4 | - | |
| 5 | -import javax.persistence.*; | |
| 6 | -import java.util.Date; | |
| 7 | - | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * | |
| 11 | - * @ClassName: ChildTaskPlan | |
| 12 | - * @Description: TODO(子任务) | |
| 13 | - * @author PanZhao | |
| 14 | - * @date 2016年6月20日 上午11:22:22 | |
| 15 | - * | |
| 16 | - */ | |
| 17 | -@Entity | |
| 18 | -@Table(name = "bsth_c_s_child_task") | |
| 19 | -@NamedEntityGraphs({ | |
| 20 | - @NamedEntityGraph(name = "childTaskPlan_schedule", attributeNodes = { | |
| 21 | - @NamedAttributeNode("schedule") | |
| 22 | - }) | |
| 23 | -}) | |
| 24 | -public class ChildTaskPlan { | |
| 25 | - | |
| 26 | - @Id | |
| 27 | - @GeneratedValue | |
| 28 | - private Long id; | |
| 29 | - | |
| 30 | - /** | |
| 31 | - * 任务类型1 | |
| 32 | - * 正常,临加 | |
| 33 | - */ | |
| 34 | - private String type1; | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * 任务类型2 | |
| 38 | - */ | |
| 39 | - private String type2; | |
| 40 | - | |
| 41 | - /** | |
| 42 | - * 起点 | |
| 43 | - */ | |
| 44 | - private String startStation; | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * 起点站名称 | |
| 48 | - */ | |
| 49 | - private String startStationName; | |
| 50 | - | |
| 51 | - /** | |
| 52 | - * 终点 | |
| 53 | - */ | |
| 54 | - private String endStation; | |
| 55 | - | |
| 56 | - /** | |
| 57 | - * 终点站名称 | |
| 58 | - */ | |
| 59 | - private String endStationName; | |
| 60 | - | |
| 61 | - /** | |
| 62 | - * 里程类型 | |
| 63 | - */ | |
| 64 | - private String mileageType; | |
| 65 | - | |
| 66 | - /** | |
| 67 | - * 里程 | |
| 68 | - */ | |
| 69 | - private Float mileage; | |
| 70 | - | |
| 71 | - /** | |
| 72 | - * 开始时间 HH:mm | |
| 73 | - */ | |
| 74 | - private String startDate; | |
| 75 | - | |
| 76 | - /** | |
| 77 | - * 结束时间 HH:mm | |
| 78 | - */ | |
| 79 | - private String endDate; | |
| 80 | - | |
| 81 | - /** | |
| 82 | - * 是否烂班 | |
| 83 | - */ | |
| 84 | - private boolean destroy; | |
| 85 | - | |
| 86 | - /** | |
| 87 | - * 烂班原因 -烂班时,该字段仍有值并 =reason | |
| 88 | - */ | |
| 89 | - private String destroyReason; | |
| 90 | - | |
| 91 | - /** | |
| 92 | - * 包括 烂班原因、进出场原因、换车原因 等 | |
| 93 | - */ | |
| 94 | - private String reason; | |
| 95 | - | |
| 96 | - /** | |
| 97 | - * 车辆 如果为空,继承主任务 | |
| 98 | - */ | |
| 99 | - private String nbbm; | |
| 100 | - | |
| 101 | - /** | |
| 102 | - * 为true 则无售票员, 否则继承主任务 | |
| 103 | - */ | |
| 104 | - private boolean noClerk; | |
| 105 | - | |
| 106 | - /** 创建日期 */ | |
| 107 | - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 108 | - private Date createDate; | |
| 109 | - | |
| 110 | - /** | |
| 111 | - * 主排班计划 | |
| 112 | - */ | |
| 113 | - @JsonIgnore | |
| 114 | - @ManyToOne(fetch = FetchType.LAZY) | |
| 115 | - @JoinColumn(name = "schedule") | |
| 116 | - private ScheduleRealInfo schedule; | |
| 117 | - | |
| 118 | - private String remarks; | |
| 119 | - | |
| 120 | - public Long getId() { | |
| 121 | - return id; | |
| 122 | - } | |
| 123 | - | |
| 124 | - public void setId(Long id) { | |
| 125 | - this.id = id; | |
| 126 | - } | |
| 127 | - | |
| 128 | - public String getType1() { | |
| 129 | - return type1; | |
| 130 | - } | |
| 131 | - | |
| 132 | - public void setType1(String type1) { | |
| 133 | - this.type1 = type1; | |
| 134 | - } | |
| 135 | - | |
| 136 | - public String getType2() { | |
| 137 | - return type2; | |
| 138 | - } | |
| 139 | - | |
| 140 | - public void setType2(String type2) { | |
| 141 | - this.type2 = type2; | |
| 142 | - } | |
| 143 | - | |
| 144 | - public String getStartStation() { | |
| 145 | - return startStation; | |
| 146 | - } | |
| 147 | - | |
| 148 | - public void setStartStation(String startStation) { | |
| 149 | - this.startStation = startStation; | |
| 150 | - } | |
| 151 | - | |
| 152 | - public String getEndStation() { | |
| 153 | - return endStation; | |
| 154 | - } | |
| 155 | - | |
| 156 | - public void setEndStation(String endStation) { | |
| 157 | - this.endStation = endStation; | |
| 158 | - } | |
| 159 | - | |
| 160 | - public String getMileageType() { | |
| 161 | - return mileageType; | |
| 162 | - } | |
| 163 | - | |
| 164 | - public void setMileageType(String mileageType) { | |
| 165 | - this.mileageType = mileageType; | |
| 166 | - } | |
| 167 | - | |
| 168 | - public Float getMileage() { | |
| 169 | - return mileage; | |
| 170 | - } | |
| 171 | - | |
| 172 | - public void setMileage(Float mileage) { | |
| 173 | - this.mileage = mileage; | |
| 174 | - } | |
| 175 | - | |
| 176 | - public String getStartDate() { | |
| 177 | - return startDate; | |
| 178 | - } | |
| 179 | - | |
| 180 | - public void setStartDate(String startDate) { | |
| 181 | - this.startDate = startDate; | |
| 182 | - } | |
| 183 | - | |
| 184 | - public String getEndDate() { | |
| 185 | - return endDate; | |
| 186 | - } | |
| 187 | - | |
| 188 | - public void setEndDate(String endDate) { | |
| 189 | - this.endDate = endDate; | |
| 190 | - } | |
| 191 | - | |
| 192 | - public boolean isDestroy() { | |
| 193 | - return destroy; | |
| 194 | - } | |
| 195 | - | |
| 196 | - public void setDestroy(boolean destroy) { | |
| 197 | - this.destroy = destroy; | |
| 198 | - } | |
| 199 | - | |
| 200 | - public String getDestroyReason() { | |
| 201 | - return destroyReason; | |
| 202 | - } | |
| 203 | - | |
| 204 | - public void setDestroyReason(String destroyReason) { | |
| 205 | - this.destroyReason = destroyReason; | |
| 206 | - } | |
| 207 | - | |
| 208 | - public ScheduleRealInfo getSchedule() { | |
| 209 | - return schedule; | |
| 210 | - } | |
| 211 | - | |
| 212 | - public void setSchedule(ScheduleRealInfo schedule) { | |
| 213 | - this.schedule = schedule; | |
| 214 | - } | |
| 215 | - | |
| 216 | - public String getRemarks() { | |
| 217 | - return remarks; | |
| 218 | - } | |
| 219 | - | |
| 220 | - public void setRemarks(String remarks) { | |
| 221 | - this.remarks = remarks; | |
| 222 | - } | |
| 223 | - | |
| 224 | - public String getStartStationName() { | |
| 225 | - return startStationName; | |
| 226 | - } | |
| 227 | - | |
| 228 | - public void setStartStationName(String startStationName) { | |
| 229 | - this.startStationName = startStationName; | |
| 230 | - } | |
| 231 | - | |
| 232 | - public String getEndStationName() { | |
| 233 | - return endStationName; | |
| 234 | - } | |
| 235 | - | |
| 236 | - public void setEndStationName(String endStationName) { | |
| 237 | - this.endStationName = endStationName; | |
| 238 | - } | |
| 239 | - | |
| 240 | - @Override | |
| 241 | - public int hashCode() { | |
| 242 | - return ("cTask" + this.getId() + this.getSchedule().getId()).hashCode(); | |
| 243 | - } | |
| 244 | - | |
| 245 | - @Override | |
| 246 | - public boolean equals(Object obj) { | |
| 247 | - return this.id.equals(((ChildTaskPlan)obj).getId()); | |
| 248 | - } | |
| 249 | - | |
| 250 | - public Date getCreateDate() { | |
| 251 | - return createDate; | |
| 252 | - } | |
| 253 | - | |
| 254 | - public void setCreateDate(Date createDate) { | |
| 255 | - this.createDate = createDate; | |
| 256 | - } | |
| 257 | - | |
| 258 | - public String getReason() { | |
| 259 | - return reason; | |
| 260 | - } | |
| 261 | - | |
| 262 | - public void setReason(String reason) { | |
| 263 | - this.reason = reason; | |
| 264 | - } | |
| 265 | - | |
| 266 | - public String getNbbm() { | |
| 267 | - return nbbm; | |
| 268 | - } | |
| 269 | - | |
| 270 | - public void setNbbm(String nbbm) { | |
| 271 | - this.nbbm = nbbm; | |
| 272 | - } | |
| 273 | - | |
| 274 | - public boolean isNoClerk() { | |
| 275 | - return noClerk; | |
| 276 | - } | |
| 277 | - | |
| 278 | - public void setNoClerk(boolean noClerk) { | |
| 279 | - this.noClerk = noClerk; | |
| 280 | - } | |
| 281 | -} | |
| 1 | +package com.bsth.entity; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnore; | |
| 4 | + | |
| 5 | +import javax.persistence.*; | |
| 6 | +import java.util.Date; | |
| 7 | + | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * | |
| 11 | + * @ClassName: ChildTaskPlan | |
| 12 | + * @Description: TODO(子任务) | |
| 13 | + * @author PanZhao | |
| 14 | + * @date 2016年6月20日 上午11:22:22 | |
| 15 | + * | |
| 16 | + */ | |
| 17 | +@Entity | |
| 18 | +@Table(name = "bsth_c_s_child_task") | |
| 19 | +@NamedEntityGraphs({ | |
| 20 | + @NamedEntityGraph(name = "childTaskPlan_schedule", attributeNodes = { | |
| 21 | + @NamedAttributeNode("schedule") | |
| 22 | + }) | |
| 23 | +}) | |
| 24 | +public class ChildTaskPlan { | |
| 25 | + | |
| 26 | + @Id | |
| 27 | + @GeneratedValue | |
| 28 | + private Long id; | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 任务类型1 | |
| 32 | + * 正常,临加 | |
| 33 | + */ | |
| 34 | + private String type1; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 任务类型2 | |
| 38 | + */ | |
| 39 | + private String type2; | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 起点 | |
| 43 | + */ | |
| 44 | + private String startStation; | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 起点站名称 | |
| 48 | + */ | |
| 49 | + private String startStationName; | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 终点 | |
| 53 | + */ | |
| 54 | + private String endStation; | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 终点站名称 | |
| 58 | + */ | |
| 59 | + private String endStationName; | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * 里程类型 | |
| 63 | + */ | |
| 64 | + private String mileageType; | |
| 65 | + | |
| 66 | + /** | |
| 67 | + * 里程 | |
| 68 | + */ | |
| 69 | + private Float mileage; | |
| 70 | + | |
| 71 | + /** | |
| 72 | + * 开始时间 HH:mm | |
| 73 | + */ | |
| 74 | + private String startDate; | |
| 75 | + | |
| 76 | + /** | |
| 77 | + * 结束时间 HH:mm | |
| 78 | + */ | |
| 79 | + private String endDate; | |
| 80 | + | |
| 81 | + /** | |
| 82 | + * 是否烂班 | |
| 83 | + */ | |
| 84 | + private boolean destroy; | |
| 85 | + | |
| 86 | + /** | |
| 87 | + * 烂班原因 -烂班时,该字段仍有值并 =reason | |
| 88 | + */ | |
| 89 | + private String destroyReason; | |
| 90 | + | |
| 91 | + /** | |
| 92 | + * 包括 烂班原因、进出场原因、换车原因 等 | |
| 93 | + */ | |
| 94 | + private String reason; | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * 车辆 如果为空,继承主任务 | |
| 98 | + */ | |
| 99 | + private String nbbm; | |
| 100 | + | |
| 101 | + /** | |
| 102 | + * 为true 则无售票员, 否则继承主任务 | |
| 103 | + */ | |
| 104 | + private boolean noClerk; | |
| 105 | + | |
| 106 | + /** 创建日期 */ | |
| 107 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 108 | + private Date createDate; | |
| 109 | + | |
| 110 | + /** | |
| 111 | + * 主排班计划 | |
| 112 | + */ | |
| 113 | + @JsonIgnore | |
| 114 | + @ManyToOne(fetch = FetchType.LAZY) | |
| 115 | + @JoinColumn(name = "schedule") | |
| 116 | + private ScheduleRealInfo schedule; | |
| 117 | + | |
| 118 | + private String remarks; | |
| 119 | + | |
| 120 | + public Long getId() { | |
| 121 | + return id; | |
| 122 | + } | |
| 123 | + | |
| 124 | + public void setId(Long id) { | |
| 125 | + this.id = id; | |
| 126 | + } | |
| 127 | + | |
| 128 | + public String getType1() { | |
| 129 | + return type1; | |
| 130 | + } | |
| 131 | + | |
| 132 | + public void setType1(String type1) { | |
| 133 | + this.type1 = type1; | |
| 134 | + } | |
| 135 | + | |
| 136 | + public String getType2() { | |
| 137 | + return type2; | |
| 138 | + } | |
| 139 | + | |
| 140 | + public void setType2(String type2) { | |
| 141 | + this.type2 = type2; | |
| 142 | + } | |
| 143 | + | |
| 144 | + public String getStartStation() { | |
| 145 | + return startStation; | |
| 146 | + } | |
| 147 | + | |
| 148 | + public void setStartStation(String startStation) { | |
| 149 | + this.startStation = startStation; | |
| 150 | + } | |
| 151 | + | |
| 152 | + public String getEndStation() { | |
| 153 | + return endStation; | |
| 154 | + } | |
| 155 | + | |
| 156 | + public void setEndStation(String endStation) { | |
| 157 | + this.endStation = endStation; | |
| 158 | + } | |
| 159 | + | |
| 160 | + public String getMileageType() { | |
| 161 | + return mileageType; | |
| 162 | + } | |
| 163 | + | |
| 164 | + public void setMileageType(String mileageType) { | |
| 165 | + this.mileageType = mileageType; | |
| 166 | + } | |
| 167 | + | |
| 168 | + public Float getMileage() { | |
| 169 | + return mileage; | |
| 170 | + } | |
| 171 | + | |
| 172 | + public void setMileage(Float mileage) { | |
| 173 | + this.mileage = mileage; | |
| 174 | + } | |
| 175 | + | |
| 176 | + public String getStartDate() { | |
| 177 | + return startDate; | |
| 178 | + } | |
| 179 | + | |
| 180 | + public void setStartDate(String startDate) { | |
| 181 | + this.startDate = startDate; | |
| 182 | + } | |
| 183 | + | |
| 184 | + public String getEndDate() { | |
| 185 | + return endDate; | |
| 186 | + } | |
| 187 | + | |
| 188 | + public void setEndDate(String endDate) { | |
| 189 | + this.endDate = endDate; | |
| 190 | + } | |
| 191 | + | |
| 192 | + public boolean isDestroy() { | |
| 193 | + return destroy; | |
| 194 | + } | |
| 195 | + | |
| 196 | + public void setDestroy(boolean destroy) { | |
| 197 | + this.destroy = destroy; | |
| 198 | + } | |
| 199 | + | |
| 200 | + public String getDestroyReason() { | |
| 201 | + return destroyReason; | |
| 202 | + } | |
| 203 | + | |
| 204 | + public void setDestroyReason(String destroyReason) { | |
| 205 | + this.destroyReason = destroyReason; | |
| 206 | + } | |
| 207 | + | |
| 208 | + public ScheduleRealInfo getSchedule() { | |
| 209 | + return schedule; | |
| 210 | + } | |
| 211 | + | |
| 212 | + public void setSchedule(ScheduleRealInfo schedule) { | |
| 213 | + this.schedule = schedule; | |
| 214 | + } | |
| 215 | + | |
| 216 | + public String getRemarks() { | |
| 217 | + return remarks; | |
| 218 | + } | |
| 219 | + | |
| 220 | + public void setRemarks(String remarks) { | |
| 221 | + this.remarks = remarks; | |
| 222 | + } | |
| 223 | + | |
| 224 | + public String getStartStationName() { | |
| 225 | + return startStationName; | |
| 226 | + } | |
| 227 | + | |
| 228 | + public void setStartStationName(String startStationName) { | |
| 229 | + this.startStationName = startStationName; | |
| 230 | + } | |
| 231 | + | |
| 232 | + public String getEndStationName() { | |
| 233 | + return endStationName; | |
| 234 | + } | |
| 235 | + | |
| 236 | + public void setEndStationName(String endStationName) { | |
| 237 | + this.endStationName = endStationName; | |
| 238 | + } | |
| 239 | + | |
| 240 | + @Override | |
| 241 | + public int hashCode() { | |
| 242 | + return ("cTask" + this.getId() + this.getSchedule().getId()).hashCode(); | |
| 243 | + } | |
| 244 | + | |
| 245 | + @Override | |
| 246 | + public boolean equals(Object obj) { | |
| 247 | + return this.id.equals(((ChildTaskPlan)obj).getId()); | |
| 248 | + } | |
| 249 | + | |
| 250 | + public Date getCreateDate() { | |
| 251 | + return createDate; | |
| 252 | + } | |
| 253 | + | |
| 254 | + public void setCreateDate(Date createDate) { | |
| 255 | + this.createDate = createDate; | |
| 256 | + } | |
| 257 | + | |
| 258 | + public String getReason() { | |
| 259 | + return reason; | |
| 260 | + } | |
| 261 | + | |
| 262 | + public void setReason(String reason) { | |
| 263 | + this.reason = reason; | |
| 264 | + } | |
| 265 | + | |
| 266 | + public String getNbbm() { | |
| 267 | + return nbbm; | |
| 268 | + } | |
| 269 | + | |
| 270 | + public void setNbbm(String nbbm) { | |
| 271 | + this.nbbm = nbbm; | |
| 272 | + } | |
| 273 | + | |
| 274 | + public boolean isNoClerk() { | |
| 275 | + return noClerk; | |
| 276 | + } | |
| 277 | + | |
| 278 | + public void setNoClerk(boolean noClerk) { | |
| 279 | + this.noClerk = noClerk; | |
| 280 | + } | |
| 281 | +} | ... | ... |
src/main/java/com/bsth/service/ScheduleRealInfoService.java
| 1 | -package com.bsth.service; | |
| 2 | - | |
| 3 | -import com.bsth.entity.ScheduleRealInfo; | |
| 4 | -import com.bsth.entity.result.CalcWaybill; | |
| 5 | - | |
| 6 | -import java.util.List; | |
| 7 | - | |
| 8 | -/** | |
| 9 | - * Created by panzhao on 2017/7/27. | |
| 10 | - */ | |
| 11 | -public interface ScheduleRealInfoService { | |
| 12 | - | |
| 13 | - List<CalcWaybill> findAll(String rq,String lineCode); | |
| 14 | - | |
| 15 | -} | |
| 1 | +package com.bsth.service; | |
| 2 | + | |
| 3 | +import com.bsth.entity.ScheduleRealInfo; | |
| 4 | +import com.bsth.entity.result.CalcWaybill; | |
| 5 | + | |
| 6 | +import java.util.List; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * Created by panzhao on 2017/7/27. | |
| 10 | + */ | |
| 11 | +public interface ScheduleRealInfoService { | |
| 12 | + | |
| 13 | + List<CalcWaybill> findAll(String rq,String lineCode); | |
| 14 | + | |
| 15 | +} | ... | ... |
src/main/java/com/bsth/service/impl/ScheduleRealInfoServiceImpl.java
| 1 | -package com.bsth.service.impl; | |
| 2 | - | |
| 3 | -import com.bsth.entity.LineConfig; | |
| 4 | -import com.bsth.entity.ScheduleRealInfo; | |
| 5 | -import com.bsth.entity.result.CalcWaybill; | |
| 6 | -import com.bsth.repository.ScheduleRealInfoRepository; | |
| 7 | -import com.bsth.service.LineConfigService; | |
| 8 | -import com.bsth.service.ScheduleRealInfoService; | |
| 9 | -import org.apache.commons.lang3.StringUtils; | |
| 10 | -import org.joda.time.format.DateTimeFormat; | |
| 11 | -import org.joda.time.format.DateTimeFormatter; | |
| 12 | -import org.slf4j.Logger; | |
| 13 | -import org.slf4j.LoggerFactory; | |
| 14 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 15 | -import org.springframework.jdbc.core.JdbcTemplate; | |
| 16 | -import org.springframework.jdbc.core.RowMapper; | |
| 17 | -import org.springframework.stereotype.Service; | |
| 18 | - | |
| 19 | -import java.sql.ResultSet; | |
| 20 | -import java.sql.SQLException; | |
| 21 | -import java.util.ArrayList; | |
| 22 | -import java.util.HashMap; | |
| 23 | -import java.util.List; | |
| 24 | -import java.util.Map; | |
| 25 | -import java.util.Set; | |
| 26 | -import com.bsth.entity.ChildTaskPlan; | |
| 27 | - | |
| 28 | -/** | |
| 29 | - * Created by panzhao on 2017/7/27. | |
| 30 | - */ | |
| 31 | -@Service | |
| 32 | -public class ScheduleRealInfoServiceImpl implements ScheduleRealInfoService { | |
| 33 | - | |
| 34 | - @Autowired | |
| 35 | - ScheduleRealInfoRepository scheduleRealInfoRepository; | |
| 36 | - | |
| 37 | - @Autowired | |
| 38 | - JdbcTemplate jdbcTemplate; | |
| 39 | - | |
| 40 | - @Autowired | |
| 41 | - LineConfigService lineConfigService; | |
| 42 | - | |
| 43 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 44 | - | |
| 45 | - private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"), | |
| 46 | - fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"), | |
| 47 | - fmtHHmm = DateTimeFormat.forPattern("HH:mm"); | |
| 48 | - | |
| 49 | - private final static long DAY_TIME = 1000 * 60 * 60 * 24L; | |
| 50 | - | |
| 51 | - @Override | |
| 52 | - public List<CalcWaybill> findAll(String rq,String lineCode) { | |
| 53 | - List<ScheduleRealInfo> list = scheduleRealInfoRepository.findAll(rq,lineCode); | |
| 54 | - String sql ="select r.j_gh ,r.s_gh,r.cl_zbh,r.xl_bm, r.lp_name FROM" | |
| 55 | - + " bsth_c_s_sp_info_real r where " | |
| 56 | - + " r.schedule_date_str='"+rq+"' and r.xl_bm = '"+lineCode+"'" | |
| 57 | - + " GROUP BY r.j_gh,r.xl_bm,r.lp_name "; | |
| 58 | - | |
| 59 | - List<Map<String, String>> listMap = jdbcTemplate.query(sql, new RowMapper<Map<String, String>>() { | |
| 60 | - @Override | |
| 61 | - public Map<String, String> mapRow(ResultSet arg0, int arg1) throws SQLException { | |
| 62 | - Map<String, String> c = new HashMap<String,String>(); | |
| 63 | - c.put("jGh", arg0.getString("j_gh")); | |
| 64 | - c.put("sGh", arg0.getString("s_gh")==null?"":arg0.getString("s_gh")); | |
| 65 | - c.put("clZbh", arg0.getString("cl_zbh")); | |
| 66 | - c.put("xlBm", arg0.getString("xl_bm")); | |
| 67 | - c.put("lpName", arg0.getString("lp_name")); | |
| 68 | - return c; | |
| 69 | - } | |
| 70 | - }); | |
| 71 | - for (int i = 0; i < listMap.size(); i++) { | |
| 72 | - Map<String, String> m=listMap.get(i); | |
| 73 | - String jGh=m.get("jGh"); | |
| 74 | - String sGh=m.get("sGh"); | |
| 75 | - String clZbh=m.get("clZbh"); | |
| 76 | - String xlBm=m.get("xlBm"); | |
| 77 | - String lpName=m.get("lpName"); | |
| 78 | - //所有数据排班数据 | |
| 79 | - List<ScheduleRealInfo> list_=new ArrayList<ScheduleRealInfo>(); | |
| 80 | - //执行了的班次的排班数据 | |
| 81 | - List<ScheduleRealInfo> lists_=new ArrayList<ScheduleRealInfo>(); | |
| 82 | - for (int j = 0; j < list.size(); j++) { | |
| 83 | - ScheduleRealInfo s=list.get(j); | |
| 84 | - if(jGh.equals(s.getjGh()) | |
| 85 | - && sGh.equals(s.getsGh()==null?"":s.getsGh()) | |
| 86 | - && clZbh.equals(s.getClZbh()) | |
| 87 | - && xlBm.equals(s.getXlBm()) | |
| 88 | - && lpName.equals(s.getLpName())){ | |
| 89 | - | |
| 90 | - list_.add(s); | |
| 91 | - | |
| 92 | - Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 93 | - if(cts != null && cts.size() > 0){ | |
| 94 | - lists_.add(s); | |
| 95 | - }else{ | |
| 96 | - if(s.getZdsjActual()!=null | |
| 97 | - && s.getFcsjActual() !=null){ | |
| 98 | - lists_.add(s); | |
| 99 | - } | |
| 100 | - } | |
| 101 | - } | |
| 102 | - } | |
| 103 | - | |
| 104 | - | |
| 105 | - } | |
| 106 | - return null; | |
| 107 | - } | |
| 108 | - | |
| 109 | -} | |
| 1 | +package com.bsth.service.impl; | |
| 2 | + | |
| 3 | +import com.bsth.entity.ScheduleRealInfo; | |
| 4 | +import com.bsth.entity.result.CalcWaybill; | |
| 5 | +import com.bsth.repository.ScheduleRealInfoRepository; | |
| 6 | +import com.bsth.service.*; | |
| 7 | + | |
| 8 | +import org.joda.time.format.DateTimeFormat; | |
| 9 | +import org.joda.time.format.DateTimeFormatter; | |
| 10 | +import org.slf4j.Logger; | |
| 11 | +import org.slf4j.LoggerFactory; | |
| 12 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 13 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 14 | +import org.springframework.jdbc.core.RowMapper; | |
| 15 | +import org.springframework.stereotype.Service; | |
| 16 | + | |
| 17 | +import java.sql.ResultSet; | |
| 18 | +import java.sql.SQLException; | |
| 19 | +import java.util.ArrayList; | |
| 20 | +import java.util.HashMap; | |
| 21 | +import java.util.List; | |
| 22 | +import java.util.Map; | |
| 23 | +import java.util.Set; | |
| 24 | +import com.bsth.entity.*; | |
| 25 | + | |
| 26 | +/** | |
| 27 | + * Created by panzhao on 2017/7/27. | |
| 28 | + */ | |
| 29 | +@Service | |
| 30 | +public class ScheduleRealInfoServiceImpl implements ScheduleRealInfoService { | |
| 31 | + | |
| 32 | + @Autowired | |
| 33 | + ScheduleRealInfoRepository scheduleRealInfoRepository; | |
| 34 | + | |
| 35 | + @Autowired | |
| 36 | + JdbcTemplate jdbcTemplate; | |
| 37 | + | |
| 38 | + @Autowired | |
| 39 | + LineConfigService lineConfigService; | |
| 40 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 41 | + | |
| 42 | + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"), | |
| 43 | + fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"), | |
| 44 | + fmtHHmm = DateTimeFormat.forPattern("HH:mm"); | |
| 45 | + | |
| 46 | + private final static long DAY_TIME = 1000 * 60 * 60 * 24L; | |
| 47 | + | |
| 48 | + @Override | |
| 49 | + public List<CalcWaybill> findAll(String rq,String lineCode) { | |
| 50 | + List<ScheduleRealInfo> list = scheduleRealInfoRepository.findAll(rq,lineCode); | |
| 51 | + String sql ="select r.j_gh ,r.s_gh,r.cl_zbh,r.xl_bm, r.lp_name FROM" | |
| 52 | + + " bsth_c_s_sp_info_real r where " | |
| 53 | + + " r.schedule_date_str='"+rq+"' and r.xl_bm = '"+lineCode+"'" | |
| 54 | + + " GROUP BY r.j_gh,r.xl_bm,r.lp_name "; | |
| 55 | + | |
| 56 | + List<Map<String, String>> listMap = jdbcTemplate.query(sql, new RowMapper<Map<String, String>>() { | |
| 57 | + @Override | |
| 58 | + public Map<String, String> mapRow(ResultSet arg0, int arg1) throws SQLException { | |
| 59 | + Map<String, String> c = new HashMap<String,String>(); | |
| 60 | + c.put("jGh", arg0.getString("j_gh")); | |
| 61 | + c.put("sGh", arg0.getString("s_gh")==null?"":arg0.getString("s_gh")); | |
| 62 | + c.put("clZbh", arg0.getString("cl_zbh")); | |
| 63 | + c.put("xlBm", arg0.getString("xl_bm")); | |
| 64 | + c.put("lpName", arg0.getString("lp_name")); | |
| 65 | + return c; | |
| 66 | + } | |
| 67 | + }); | |
| 68 | + for (int i = 0; i < listMap.size(); i++) { | |
| 69 | + Map<String, String> m=listMap.get(i); | |
| 70 | + String jGh=m.get("jGh"); | |
| 71 | + String sGh=m.get("sGh"); | |
| 72 | + String clZbh=m.get("clZbh"); | |
| 73 | + String xlBm=m.get("xlBm"); | |
| 74 | + String lpName=m.get("lpName"); | |
| 75 | + //所有数据排班数据 | |
| 76 | + List<ScheduleRealInfo> list_=new ArrayList<ScheduleRealInfo>(); | |
| 77 | + //执行了的班次的排班数据 | |
| 78 | + List<ScheduleRealInfo> lists_=new ArrayList<ScheduleRealInfo>(); | |
| 79 | + for (int j = 0; j < list.size(); j++) { | |
| 80 | + ScheduleRealInfo s=list.get(j); | |
| 81 | + if(jGh.equals(s.getjGh()) | |
| 82 | + && sGh.equals(s.getsGh()==null?"":s.getsGh()) | |
| 83 | + && clZbh.equals(s.getClZbh()) | |
| 84 | + && xlBm.equals(s.getXlBm()) | |
| 85 | + && lpName.equals(s.getLpName())){ | |
| 86 | + | |
| 87 | + list_.add(s); | |
| 88 | + | |
| 89 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 90 | + if(cts != null && cts.size() > 0){ | |
| 91 | + lists_.add(s); | |
| 92 | + }else{ | |
| 93 | + if(s.getZdsjActual()!=null | |
| 94 | + && s.getFcsjActual() !=null){ | |
| 95 | + lists_.add(s); | |
| 96 | + } | |
| 97 | + } | |
| 98 | + } | |
| 99 | + } | |
| 100 | + | |
| 101 | + | |
| 102 | + } | |
| 103 | + return null; | |
| 104 | + } | |
| 105 | + | |
| 106 | +} | ... | ... |