Commit 0e1083c8b21d9aaaba3dac40f53999d1e473731d

Authored by 王通
1 parent dc50fc6b

1.接收路单的同时接收子任务

src/main/java/com/bsth/entity/ChildTaskPlan.java
1 -package com.bsth.entity;  
2 -  
3 -import com.bsth.server_rs.adapter.DateTimeAdapter;  
4 -import com.fasterxml.jackson.annotation.JsonIgnore;  
5 -  
6 -import javax.persistence.*;  
7 -import javax.xml.bind.annotation.XmlRootElement;  
8 -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;  
9 -import java.io.Serializable;  
10 -import java.util.Date;  
11 -  
12 -  
13 -/**  
14 - *  
15 - * @ClassName: ChildTaskPlan  
16 - * @Description: TODO(子任务)  
17 - * @author PanZhao  
18 - * @date 2016年6月20日 上午11:22:22  
19 - *  
20 - */  
21 -@XmlRootElement  
22 -@Entity  
23 -@Table(name = "bsth_c_s_child_task")  
24 -@NamedEntityGraphs({  
25 - @NamedEntityGraph(name = "childTaskPlan_schedule", attributeNodes = {  
26 - @NamedAttributeNode("schedule")  
27 - })  
28 -})  
29 -public class ChildTaskPlan implements Serializable {  
30 -  
31 - @Id  
32 - private Long id;  
33 -  
34 - /**  
35 - * 任务类型1  
36 - * 正常,临加  
37 - */  
38 - private String type1;  
39 -  
40 - /**  
41 - * 任务类型2  
42 - * 1 线路上站点间  
43 - * 2 进场  
44 - * 3 出场  
45 - * 4 区间掉头  
46 - */  
47 - private String type2;  
48 -  
49 - /**  
50 - * 起点  
51 - */  
52 - private String startStation;  
53 -  
54 - /**  
55 - * 起点站名称  
56 - */  
57 - private String startStationName;  
58 -  
59 - /**  
60 - * 终点  
61 - */  
62 - private String endStation;  
63 -  
64 - /**  
65 - * 终点站名称  
66 - */  
67 - private String endStationName;  
68 -  
69 - /**  
70 - * 里程类型  
71 - */  
72 - private String mileageType;  
73 -  
74 - /**  
75 - * 里程  
76 - */  
77 - private Float mileage;  
78 -  
79 - /**  
80 - * 开始时间 HH:mm  
81 - */  
82 - private String startDate;  
83 -  
84 - /**  
85 - * 结束时间 HH:mm  
86 - */  
87 - private String endDate;  
88 -  
89 - /**  
90 - * 是否烂班  
91 - */  
92 - private boolean destroy;  
93 -  
94 - /**  
95 - * 烂班原因  
96 - */  
97 - private String destroyReason;  
98 -  
99 - /**  
100 - * 车辆 如果为空,继承主任务  
101 - */  
102 - private String nbbm;  
103 -  
104 - /**  
105 - * 中途换车营运, 新车关联的主任务ID,子任务删除时,主任务ID将级联  
106 - */  
107 - private Long ccId;  
108 -  
109 - /**  
110 - * 为true 则无售票员, 否则继承主任务  
111 - */  
112 - private boolean noClerk;  
113 -  
114 - /** 创建日期 */  
115 - private Date createDate;  
116 -  
117 - /**  
118 - * 主排班计划  
119 - */  
120 - @JsonIgnore  
121 - @ManyToOne(fetch = FetchType.LAZY)  
122 - @JoinColumn(name = "schedule")  
123 - private ScheduleRealInfo schedule;  
124 -  
125 - private String remarks;  
126 -  
127 - public Long getId() {  
128 - return id;  
129 - }  
130 -  
131 - public void setId(Long id) {  
132 - this.id = id;  
133 - }  
134 -  
135 - public String getType1() {  
136 - return type1;  
137 - }  
138 -  
139 - public void setType1(String type1) {  
140 - this.type1 = type1;  
141 - }  
142 -  
143 - public String getType2() {  
144 - return type2;  
145 - }  
146 -  
147 - public void setType2(String type2) {  
148 - this.type2 = type2;  
149 - }  
150 -  
151 - public String getStartStation() {  
152 - return startStation;  
153 - }  
154 -  
155 - public void setStartStation(String startStation) {  
156 - this.startStation = startStation;  
157 - }  
158 -  
159 - public String getEndStation() {  
160 - return endStation;  
161 - }  
162 -  
163 - public void setEndStation(String endStation) {  
164 - this.endStation = endStation;  
165 - }  
166 -  
167 - public String getMileageType() {  
168 - return mileageType;  
169 - }  
170 -  
171 - public void setMileageType(String mileageType) {  
172 - this.mileageType = mileageType;  
173 - }  
174 -  
175 - public Float getMileage() {  
176 - return mileage;  
177 - }  
178 -  
179 - public void setMileage(Float mileage) {  
180 - this.mileage = mileage;  
181 - }  
182 -  
183 - public String getStartDate() {  
184 - return startDate;  
185 - }  
186 -  
187 - public void setStartDate(String startDate) {  
188 - this.startDate = startDate;  
189 - }  
190 -  
191 - public String getEndDate() {  
192 - return endDate;  
193 - }  
194 -  
195 - public void setEndDate(String endDate) {  
196 - this.endDate = endDate;  
197 - }  
198 -  
199 - public boolean isDestroy() {  
200 - return destroy;  
201 - }  
202 -  
203 - public void setDestroy(boolean destroy) {  
204 - this.destroy = destroy;  
205 - }  
206 -  
207 - public String getDestroyReason() {  
208 - return destroyReason;  
209 - }  
210 -  
211 - public void setDestroyReason(String destroyReason) {  
212 - this.destroyReason = destroyReason;  
213 - }  
214 -  
215 - public ScheduleRealInfo getSchedule() {  
216 - return schedule;  
217 - }  
218 -  
219 - public void setSchedule(ScheduleRealInfo schedule) {  
220 - this.schedule = schedule;  
221 - }  
222 -  
223 - public String getRemarks() {  
224 - return remarks;  
225 - }  
226 -  
227 - public void setRemarks(String remarks) {  
228 - this.remarks = remarks;  
229 - }  
230 -  
231 - public String getStartStationName() {  
232 - return startStationName;  
233 - }  
234 -  
235 - public void setStartStationName(String startStationName) {  
236 - this.startStationName = startStationName;  
237 - }  
238 -  
239 - public String getEndStationName() {  
240 - return endStationName;  
241 - }  
242 -  
243 - public void setEndStationName(String endStationName) {  
244 - this.endStationName = endStationName;  
245 - }  
246 -  
247 - @Override  
248 - public int hashCode() {  
249 - return ("c_task" + this.id).hashCode();  
250 - }  
251 -  
252 - @Override  
253 - public boolean equals(Object obj) {  
254 - return this.id.equals(((ChildTaskPlan)obj).getId());  
255 - }  
256 -  
257 - @XmlJavaTypeAdapter(DateTimeAdapter.class)  
258 - public Date getCreateDate() {  
259 - return createDate;  
260 - }  
261 -  
262 - public void setCreateDate(Date createDate) {  
263 - this.createDate = createDate;  
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 Long getCcId() {  
275 - return ccId;  
276 - }  
277 -  
278 - public void setCcId(Long ccId) {  
279 - this.ccId = ccId;  
280 - }  
281 -  
282 - public boolean isNoClerk() {  
283 - return noClerk;  
284 - }  
285 -  
286 - public void setNoClerk(boolean noClerk) {  
287 - this.noClerk = noClerk;  
288 - }  
289 -  
290 -} 1 +package com.bsth.entity;
  2 +
  3 +import com.bsth.server_rs.adapter.DateTimeAdapter;
  4 +import com.fasterxml.jackson.annotation.JsonIgnore;
  5 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  6 +
  7 +import javax.persistence.*;
  8 +import javax.xml.bind.annotation.XmlRootElement;
  9 +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
  10 +import java.io.Serializable;
  11 +import java.util.Date;
  12 +
  13 +
  14 +/**
  15 + *
  16 + * @ClassName: ChildTaskPlan
  17 + * @Description: TODO(子任务)
  18 + * @author PanZhao
  19 + * @date 2016年6月20日 上午11:22:22
  20 + *
  21 + */
  22 +@XmlRootElement
  23 +@Entity
  24 +@Table(name = "bsth_c_s_child_task")
  25 +@NamedEntityGraphs({
  26 + @NamedEntityGraph(name = "childTaskPlan_schedule", attributeNodes = {
  27 + @NamedAttributeNode("schedule")
  28 + })
  29 +})
  30 +@JsonIgnoreProperties(ignoreUnknown = true)
  31 +public class ChildTaskPlan implements Serializable {
  32 +
  33 + @Id
  34 + private Long id;
  35 +
  36 + /**
  37 + * 任务类型1
  38 + * 正常,临加
  39 + */
  40 + private String type1;
  41 +
  42 + /**
  43 + * 任务类型2
  44 + * 1 线路上站点间
  45 + * 2 进场
  46 + * 3 出场
  47 + * 4 区间掉头
  48 + */
  49 + private String type2;
  50 +
  51 + /**
  52 + * 起点
  53 + */
  54 + private String startStation;
  55 +
  56 + /**
  57 + * 起点站名称
  58 + */
  59 + private String startStationName;
  60 +
  61 + /**
  62 + * 终点
  63 + */
  64 + private String endStation;
  65 +
  66 + /**
  67 + * 终点站名称
  68 + */
  69 + private String endStationName;
  70 +
  71 + /**
  72 + * 里程类型
  73 + */
  74 + private String mileageType;
  75 +
  76 + /**
  77 + * 里程
  78 + */
  79 + private Float mileage;
  80 +
  81 + /**
  82 + * 开始时间 HH:mm
  83 + */
  84 + private String startDate;
  85 +
  86 + /**
  87 + * 结束时间 HH:mm
  88 + */
  89 + private String endDate;
  90 +
  91 + /**
  92 + * 是否烂班
  93 + */
  94 + private boolean destroy;
  95 +
  96 + /**
  97 + * 烂班原因
  98 + */
  99 + private String destroyReason;
  100 +
  101 + /**
  102 + * 车辆 如果为空,继承主任务
  103 + */
  104 + private String nbbm;
  105 +
  106 + /**
  107 + * 中途换车营运, 新车关联的主任务ID,子任务删除时,主任务ID将级联
  108 + */
  109 + private Long ccId;
  110 +
  111 + /**
  112 + * 为true 则无售票员, 否则继承主任务
  113 + */
  114 + private boolean noClerk;
  115 +
  116 + /** 创建日期 */
  117 + private Date createDate;
  118 +
  119 + /**
  120 + * 主排班计划
  121 + */
  122 + @JsonIgnore
  123 + @ManyToOne(fetch = FetchType.LAZY)
  124 + @JoinColumn(name = "schedule")
  125 + private ScheduleRealInfo schedule;
  126 +
  127 + private String remarks;
  128 +
  129 + private String uid;
  130 +
  131 + public Long getId() {
  132 + return id;
  133 + }
  134 +
  135 + public void setId(Long id) {
  136 + this.id = id;
  137 + }
  138 +
  139 + public String getType1() {
  140 + return type1;
  141 + }
  142 +
  143 + public void setType1(String type1) {
  144 + this.type1 = type1;
  145 + }
  146 +
  147 + public String getType2() {
  148 + return type2;
  149 + }
  150 +
  151 + public void setType2(String type2) {
  152 + this.type2 = type2;
  153 + }
  154 +
  155 + public String getStartStation() {
  156 + return startStation;
  157 + }
  158 +
  159 + public void setStartStation(String startStation) {
  160 + this.startStation = startStation;
  161 + }
  162 +
  163 + public String getEndStation() {
  164 + return endStation;
  165 + }
  166 +
  167 + public void setEndStation(String endStation) {
  168 + this.endStation = endStation;
  169 + }
  170 +
  171 + public String getMileageType() {
  172 + return mileageType;
  173 + }
  174 +
  175 + public void setMileageType(String mileageType) {
  176 + this.mileageType = mileageType;
  177 + }
  178 +
  179 + public Float getMileage() {
  180 + return mileage;
  181 + }
  182 +
  183 + public void setMileage(Float mileage) {
  184 + this.mileage = mileage;
  185 + }
  186 +
  187 + public String getStartDate() {
  188 + return startDate;
  189 + }
  190 +
  191 + public void setStartDate(String startDate) {
  192 + this.startDate = startDate;
  193 + }
  194 +
  195 + public String getEndDate() {
  196 + return endDate;
  197 + }
  198 +
  199 + public void setEndDate(String endDate) {
  200 + this.endDate = endDate;
  201 + }
  202 +
  203 + public boolean isDestroy() {
  204 + return destroy;
  205 + }
  206 +
  207 + public void setDestroy(boolean destroy) {
  208 + this.destroy = destroy;
  209 + }
  210 +
  211 + public String getDestroyReason() {
  212 + return destroyReason;
  213 + }
  214 +
  215 + public void setDestroyReason(String destroyReason) {
  216 + this.destroyReason = destroyReason;
  217 + }
  218 +
  219 + public ScheduleRealInfo getSchedule() {
  220 + return schedule;
  221 + }
  222 +
  223 + public void setSchedule(ScheduleRealInfo schedule) {
  224 + this.schedule = schedule;
  225 + }
  226 +
  227 + public String getRemarks() {
  228 + return remarks;
  229 + }
  230 +
  231 + public void setRemarks(String remarks) {
  232 + this.remarks = remarks;
  233 + }
  234 +
  235 + public String getStartStationName() {
  236 + return startStationName;
  237 + }
  238 +
  239 + public void setStartStationName(String startStationName) {
  240 + this.startStationName = startStationName;
  241 + }
  242 +
  243 + public String getEndStationName() {
  244 + return endStationName;
  245 + }
  246 +
  247 + public void setEndStationName(String endStationName) {
  248 + this.endStationName = endStationName;
  249 + }
  250 +
  251 + @Override
  252 + public int hashCode() {
  253 + return ("c_task" + this.id).hashCode();
  254 + }
  255 +
  256 + @Override
  257 + public boolean equals(Object obj) {
  258 + return this.id.equals(((ChildTaskPlan)obj).getId());
  259 + }
  260 +
  261 + @XmlJavaTypeAdapter(DateTimeAdapter.class)
  262 + public Date getCreateDate() {
  263 + return createDate;
  264 + }
  265 +
  266 + public void setCreateDate(Date createDate) {
  267 + this.createDate = createDate;
  268 + }
  269 +
  270 + public String getNbbm() {
  271 + return nbbm;
  272 + }
  273 +
  274 + public void setNbbm(String nbbm) {
  275 + this.nbbm = nbbm;
  276 + }
  277 +
  278 + public Long getCcId() {
  279 + return ccId;
  280 + }
  281 +
  282 + public void setCcId(Long ccId) {
  283 + this.ccId = ccId;
  284 + }
  285 +
  286 + public boolean isNoClerk() {
  287 + return noClerk;
  288 + }
  289 +
  290 + public void setNoClerk(boolean noClerk) {
  291 + this.noClerk = noClerk;
  292 + }
  293 +
  294 + public String getUid() {
  295 + return uid;
  296 + }
  297 +
  298 + public void setUid(String uid) {
  299 + this.uid = uid;
  300 + }
  301 +}
src/main/java/com/bsth/server_rs/schedule/SchedulePlanService.java
@@ -37,7 +37,7 @@ public class SchedulePlanService { @@ -37,7 +37,7 @@ public class SchedulePlanService {
37 public Map<String, Object> save(final List<ScheduleRealInfo> reals) throws JsonProcessingException { 37 public Map<String, Object> save(final List<ScheduleRealInfo> reals) throws JsonProcessingException {
38 Map<String, Object> result = new HashMap<>(); 38 Map<String, Object> result = new HashMap<>();
39 log.error(mapper.writeValueAsString(reals)); 39 log.error(mapper.writeValueAsString(reals));
40 - jdbcTemplate.batchUpdate("insert into zyl.bsth_c_s_sp_real_info (schedule_date_str,xl_name,lp_name,cl_zbh,jsy,spy," + 40 + jdbcTemplate.batchUpdate("insert into zyl.bsth_c_s_sp_info_real (schedule_date_str,xl_name,lp_name,cl_zbh,jsy,spy," +
41 "direction,qdz_name,zdz_name,fcsj,fcno,jhlc,bcsj,bc_type) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)", new BatchPreparedStatementSetter() { 41 "direction,qdz_name,zdz_name,fcsj,fcno,jhlc,bcsj,bc_type) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)", new BatchPreparedStatementSetter() {
42 @Override 42 @Override
43 public void setValues(PreparedStatement ps, int i) throws SQLException { 43 public void setValues(PreparedStatement ps, int i) throws SQLException {
src/main/java/com/bsth/server_rs/schedule/WaybillService.java
1 package com.bsth.server_rs.schedule; 1 package com.bsth.server_rs.schedule;
2 2
  3 +import com.bsth.entity.ChildTaskPlan;
3 import com.bsth.entity.Waybill; 4 import com.bsth.entity.Waybill;
4 import com.bsth.server_rs.gps.buffer.BasicDataBuffer; 5 import com.bsth.server_rs.gps.buffer.BasicDataBuffer;
5 import com.bsth.server_rs.gps.buffer.BasicDataRefreshThread; 6 import com.bsth.server_rs.gps.buffer.BasicDataRefreshThread;
@@ -51,11 +52,13 @@ public class WaybillService implements InitializingBean { @@ -51,11 +52,13 @@ public class WaybillService implements InitializingBean {
51 @Scheduled(cron = "0 0 0/2 * * *") 52 @Scheduled(cron = "0 0 0/2 * * *")
52 public void task() { 53 public void task() {
53 DateTime current = new DateTime(); 54 DateTime current = new DateTime();
54 - for (int i = 0;i < 2;i++) { 55 + for (int i = 0;i < 1;i++) {
55 current = current.minusDays(1); 56 current = current.minusDays(1);
56 String rq = current.toString("yyyy-MM-dd"); 57 String rq = current.toString("yyyy-MM-dd");
  58 + jdbcTemplate.update("delete b from bsth_c_s_sp_info_real a join bsth_c_s_child_task b on a.id = b.schedule where a.schedule_date_str = ? and a.xl_name like '临港中运量%'", new Object[] { rq });
57 jdbcTemplate.update("delete from bsth_c_s_sp_info_real where schedule_date_str = ? and xl_name like '临港中运量%'", new Object[] { rq }); 59 jdbcTemplate.update("delete from bsth_c_s_sp_info_real where schedule_date_str = ? and xl_name like '临港中运量%'", new Object[] { rq });
58 - jdbcTemplate.update("insert into bsth_c_s_sp_info_real SELECT * FROM zyl.bsth_c_s_sp_info_real_1 where schedule_date_str = ?", new Object[] { rq }); 60 + jdbcTemplate.update("insert into bsth_c_s_sp_info_real (id,bc_type,bcs,bcsj,cl_zbh,create_date,dfsj,directive_state,fcno,fcsj,fcsj_actual,j_gh,j_name,jhlc,lp_name,qdz_code,qdz_name,real_exec_date,remarks,s_gh,s_name,schedule_date,schedule_date_str,sflj,sp_id,status,update_date,xl_bm,xl_dir,xl_name,zdsj,zdsj_actual,zdz_code,zdz_name,create_by,update_by,ccno,df_auto,fgs_bm,fgs_name,gs_bm,gs_name,online,adjust_exps,reissue,jhlc_orig,sigin_compate,drift_status,cc_service,major_station_name,lp_change,rfid_state,first_rfid_state) SELECT id,bc_type,bcs,bcsj,cl_zbh,create_date,dfsj,directive_state,fcno,fcsj,fcsj_actual,j_gh,j_name,jhlc,lp_name,qdz_code,qdz_name,real_exec_date,remarks,s_gh,s_name,schedule_date,schedule_date_str,sflj,sp_id,status,update_date,xl_bm,xl_dir,xl_name,zdsj,zdsj_actual,zdz_code,zdz_name,create_by,update_by,ccno,df_auto,fgs_bm,fgs_name,gs_bm,gs_name,online,adjust_exps,reissue,jhlc_orig,sigin_compate,drift_status,cc_service,major_station_name,lp_change,rfid_state,first_rfid_state FROM zyl.bsth_c_s_sp_info_real_1 where schedule_date_str = ?", new Object[] { rq });
  61 + jdbcTemplate.update("insert into bsth_c_s_child_task (type1,type2,start_station_name,end_station_name,mileage_type,mileage,start_date,end_date,destroy,destroy_reason,no_clerk,remarks,schedule) SELECT type1,type2,start_station_name,end_station_name,mileage_type,mileage,start_date,end_date,destroy,destroy_reason,no_clerk,a.remarks,b.id FROM zyl.bsth_c_s_child_task_1 a join zyl.bsth_c_s_sp_info_real_1 b on a.uid = b.uid where b.schedule_date_str = ?", new Object[] { rq });
59 } 62 }
60 } 63 }
61 64
@@ -66,9 +69,11 @@ public class WaybillService implements InitializingBean { @@ -66,9 +69,11 @@ public class WaybillService implements InitializingBean {
66 if (waybills.size() > 0) { 69 if (waybills.size() > 0) {
67 Waybill waybill = waybills.get(0); 70 Waybill waybill = waybills.get(0);
68 String scheduleDateStr = new DateTime(Long.parseLong(waybill.getScheduleDateStr())).toString("yyyy-MM-dd"); 71 String scheduleDateStr = new DateTime(Long.parseLong(waybill.getScheduleDateStr())).toString("yyyy-MM-dd");
  72 + final List<ChildTaskPlan> childTaskPlans = new ArrayList<>();
  73 + jdbcTemplate.update("delete a from zyl.bsth_c_s_child_task_1 a join zyl.bsth_c_s_sp_info_real_1 b on a.uid = b.uid where schedule_date_str = ? and xl_name = ?", new Object[] { scheduleDateStr, waybill.getXlName() });
69 jdbcTemplate.update("delete from zyl.bsth_c_s_sp_info_real_1 where schedule_date_str = ? and xl_name = ?", new Object[] { scheduleDateStr, waybill.getXlName() }); 74 jdbcTemplate.update("delete from zyl.bsth_c_s_sp_info_real_1 where schedule_date_str = ? and xl_name = ?", new Object[] { scheduleDateStr, waybill.getXlName() });
70 jdbcTemplate.batchUpdate("insert into zyl.bsth_c_s_sp_info_real_1 (schedule_date_str,real_exec_date,xl_name,lp_name,cl_zbh,j_gh,j_name,s_gh,s_name," + 75 jdbcTemplate.batchUpdate("insert into zyl.bsth_c_s_sp_info_real_1 (schedule_date_str,real_exec_date,xl_name,lp_name,cl_zbh,j_gh,j_name,s_gh,s_name," +
71 - "xl_dir,qdz_name,qdz_code,zdz_name,zdz_code,fcsj,zdsj,fcno,bcs,jhlc,bcsj,bc_type,fcsj_actual,zdsj_actual,status,dfsj,gs_bm,fgs_bm,remarks,schedule_date,xl_bm,jhlc_orig,adjust_exps,gs_name,fgs_name) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", new BatchPreparedStatementSetter() { 76 + "xl_dir,qdz_name,qdz_code,zdz_name,zdz_code,fcsj,zdsj,fcno,bcs,jhlc,bcsj,bc_type,fcsj_actual,zdsj_actual,status,dfsj,gs_bm,fgs_bm,remarks,schedule_date,xl_bm,jhlc_orig,adjust_exps,gs_name,fgs_name,uid) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", new BatchPreparedStatementSetter() {
72 @Override 77 @Override
73 public void setValues(PreparedStatement ps, int i) throws SQLException { 78 public void setValues(PreparedStatement ps, int i) throws SQLException {
74 Waybill sri = waybills.get(i); 79 Waybill sri = waybills.get(i);
@@ -114,6 +119,12 @@ public class WaybillService implements InitializingBean { @@ -114,6 +119,12 @@ public class WaybillService implements InitializingBean {
114 ps.setString(32, adjustExp); 119 ps.setString(32, adjustExp);
115 ps.setString(33, BasicDataBuffer.getCompanyNameByCode(lineInfo.getCompany())); 120 ps.setString(33, BasicDataBuffer.getCompanyNameByCode(lineInfo.getCompany()));
116 ps.setString(34, BasicDataBuffer.getBranchCompanyNameByCode(lineInfo.getBrancheCompany())); 121 ps.setString(34, BasicDataBuffer.getBranchCompanyNameByCode(lineInfo.getBrancheCompany()));
  122 + String uid = UUID.randomUUID().toString();
  123 + ps.setString(35, uid);
  124 + for (ChildTaskPlan plan : sri.getcTasks()) {
  125 + plan.setUid(uid);
  126 + childTaskPlans.add(plan);
  127 + }
117 } 128 }
118 129
119 @Override 130 @Override
@@ -121,6 +132,35 @@ public class WaybillService implements InitializingBean { @@ -121,6 +132,35 @@ public class WaybillService implements InitializingBean {
121 return waybills.size(); 132 return waybills.size();
122 } 133 }
123 }); 134 });
  135 +
  136 + if (childTaskPlans.size() > 0) {
  137 + jdbcTemplate.batchUpdate("insert into zyl.bsth_c_s_child_task_1 (type1,type2,startStationName,endStationName,mileageType,mileage,startDate,endDate,destroy,destroyReason,noClerk,remarks,uid) values(?,?,?,?,?,?,?,?,?,?,?,?,?)", new BatchPreparedStatementSetter() {
  138 + @Override
  139 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  140 + ChildTaskPlan plan = childTaskPlans.get(i);
  141 + String destroyReason = plan.getDestroyReason();
  142 + String adjustExp = plan.isDestroy() ? getAdjustExp(destroyReason) : null;
  143 + ps.setString(1, plan.getType1());
  144 + ps.setString(2, plan.getType2());
  145 + ps.setString(3, plan.getStartStationName());
  146 + ps.setString(4, plan.getEndStationName());
  147 + ps.setString(5, plan.getMileageType());
  148 + ps.setFloat(6, plan.getMileage());
  149 + ps.setString(7, plan.getStartDate());
  150 + ps.setString(8, plan.getEndDate());
  151 + ps.setBoolean(9, plan.isDestroy());
  152 + ps.setString(10, plan.getDestroyReason());
  153 + ps.setBoolean(11, plan.isNoClerk());
  154 + ps.setString(12, plan.getRemarks());
  155 + ps.setString(13, plan.getUid());
  156 + }
  157 +
  158 + @Override
  159 + public int getBatchSize() {
  160 + return childTaskPlans.size();
  161 + }
  162 + });
  163 + }
124 } 164 }
125 result.put("code", 0); 165 result.put("code", 0);
126 result.put("msg", "ok"); 166 result.put("msg", "ok");
src/main/resources/application-dev.properties
1 -server.port=9089  
2 -management.port= 9001  
3 -management.address= 127.0.0.1  
4 -  
5 -spring.jpa.hibernate.ddl-auto= none  
6 -spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy  
7 -#DATABASE  
8 -spring.jpa.database= MYSQL  
9 -spring.jpa.show-sql= true  
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  
12 -spring.datasource.username= root  
13 -spring.datasource.password= root  
14 -#DATASOURCE  
15 -spring.datasource.max-active=100  
16 -spring.datasource.max-idle=8  
17 -spring.datasource.min-idle=8  
18 -spring.datasource.initial-size=5  
19 -  
20 -spring.datasource.test-on-borrow=true  
21 -spring.datasource.test-on-connect=true  
22 -spring.datasource.test-on-return=true  
23 -spring.datasource.test-while-idle=true  
24 -spring.datasource.validation-query=select 1  
25 -  
26 -  
27 -#REDIS  
28 -spring.redis.database=0  
29 -spring.redis.host=127.0.0.1  
30 -spring.redis.password=bsth_control_001  
31 -spring.redis.port=28008  
32 -  
33 -http.control.service_data_url= http://127.0.0.1:9088/companyService  
34 -http.control.secret.key= dVPHJkWUt5FhMT7jrM2dLV7QvlHAmZFd42rs1P0usBx8A7HZki  
35 -  
36 -http.gps.real.url= http://27.115.69.123:8800/transport_server/rtgps/ 1 +server.port=9089
  2 +management.port= 9001
  3 +management.address= 127.0.0.1
  4 +
  5 +spring.jpa.hibernate.ddl-auto= none
  6 +spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy
  7 +#DATABASE
  8 +spring.jpa.database= MYSQL
  9 +spring.jpa.show-sql= false
  10 +spring.datasource.driver-class-name= com.mysql.jdbc.Driver
  11 +spring.datasource.url= jdbc:mysql://10.10.150.103/control?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=utf-8&useSSL=false
  12 +spring.datasource.username= root
  13 +spring.datasource.password= Aa123456
  14 +#DATASOURCE
  15 +spring.datasource.max-active=100
  16 +spring.datasource.max-idle=8
  17 +spring.datasource.min-idle=8
  18 +spring.datasource.initial-size=3
  19 +
  20 +spring.datasource.test-on-borrow=true
  21 +spring.datasource.test-on-connect=true
  22 +spring.datasource.test-on-return=true
  23 +spring.datasource.test-while-idle=true
  24 +spring.datasource.validation-query=select 1
  25 +
  26 +#kafka
  27 +spring.kafka.bootstrap-servers= 10.10.200.203:9092
  28 +spring.kafka.consumer.group-id= zyl_group_test
  29 +spring.kafka.consumer.auto-offset-reset= latest
  30 +spring.kafka.consumer.key-deserializer= org.apache.kafka.common.serialization.StringDeserializer
  31 +spring.kafka.consumer.value-deserializer= org.apache.kafka.common.serialization.StringDeserializer
  32 +
  33 +http.control.service_data_url= http://10.10.150.103:9088/companyService
  34 +http.control.secret.key= dVPHJkWUt5FhMT7jrM2dLV7QvlHAmZFd42rs1P0usBx8A7HZki
  35 +
  36 +http.gps.real.url= http://10.10.150.103:8080/transport_server/rtgps/
  37 +
  38 +zyl.lines=
  39 +zyl.devices= 77S2C001,77S2C002,77S2C003,77S2C004,77S2C005,77S2C006,77S2C007,77S2C008,77S2C009,77S2C010,77S2C011,77S2C012,77S2C013,77S2C014,77S2C015,77S2C016,77S2C017,77S2C018,77S2C019,77S2C020,
37 \ No newline at end of file 40 \ No newline at end of file