Commit aa134516b478677f15e7af7364fc6b0b6ff5ac6a

Authored by 潘钊
2 parents b879d1b0 3cad70dd

Merge branch 'minhang' of http://222.66.0.204:8090/panzhaov5/bsth_control into minhang

src/main/java/com/bsth/controller/forms/ExportController.java
... ... @@ -303,12 +303,10 @@ public class ExportController {
303 303 m.put("fssj", l.getFssj());
304 304 m.put("xgsj", l.getXgsj());
305 305 m.put("pcch", l.getPcch());
306   - m.put("pcry", l.getPcry());
307   - m.put("jhch", l.getJhch());
308   - m.put("jhgh", l.getJhgh());
309 306 m.put("sjch", l.getSjch());
  307 + m.put("fcgh", l.getPcry());
310 308 m.put("sjgh", l.getSjgh());
311   - m.put("yy", l.getYy());
  309 + m.put("yy", l.getYy()==null?"":l.getYy());
312 310 m.put("xgr", l.getXgr());
313 311 resList.add(m);
314 312 }
... ...
src/main/java/com/bsth/controller/forms/MCY_FormsController.java
... ... @@ -66,7 +66,7 @@ public class MCY_FormsController {
66 66 }
67 67  
68 68 // 换人换车情况统计表
69   - @RequestMapping(value = "/changetochange", method = RequestMethod.POST)
  69 + @RequestMapping(value = "/changetochange", method = RequestMethod.GET)
70 70 public List<Changetochange> changetochange(@RequestParam Map<String, Object> map) {
71 71  
72 72 return formsService.changetochange(map);
... ...
src/main/java/com/bsth/controller/schedule/core/SchedulePlanInfoController.java
... ... @@ -39,6 +39,23 @@ public class SchedulePlanInfoController extends BController&lt;SchedulePlanInfo, Lo
39 39 return resultMap;
40 40 }
41 41  
  42 + @RequestMapping(value = "/lastestsd/{xlid}", method = RequestMethod.GET)
  43 + public Map<String, Object> findLastestPlanDate(
  44 + @PathVariable(value = "xlid") Integer xlid) {
  45 + Map<String, Object> resultMap = new HashMap<>();
  46 + try {
  47 + resultMap.put("status", ResponseCode.SUCCESS);
  48 + resultMap.put("data", schedulePlanInfoService.findLastestPlanDate(xlid));
  49 +
  50 + } catch (Exception exp) {
  51 + exp.printStackTrace();
  52 + resultMap.put("status", ResponseCode.ERROR);
  53 + resultMap.put("msg", exp.getLocalizedMessage());
  54 + }
  55 +
  56 + return resultMap;
  57 + }
  58 +
42 59  
43 60 // ------------------------ 老版本 ----------------------//
44 61 @RequestMapping(value = "/groupinfos/{xlid}/{date}", method = RequestMethod.GET)
... ...
src/main/java/com/bsth/data/gpsdata/thread/ThreadPollMonitor.java
1   -package com.bsth.data.gpsdata.thread;
2   -
3   -import com.bsth.data.gpsdata.arrival.GpsRealAnalyse;
4   -import org.springframework.stereotype.Component;
5   -
6   -/**
7   - * 线程池监听
8   - * Created by panzhao on 2017/5/10.
9   - */
10   -@Component
11   -public class ThreadPollMonitor extends Thread{
12   -
13   - @Override
14   - public void run() {
15   - long t = System.currentTimeMillis();
16   -
17   - if(t - GpsRealAnalyse.st > 3000 * 10){
18   - GpsRealAnalyse.shutdown();
19   - }
20   - }
21   -}
  1 +package com.bsth.data.gpsdata.thread;
  2 +
  3 +import com.bsth.data.gpsdata.arrival.GpsRealAnalyse;
  4 +import org.springframework.stereotype.Component;
  5 +
  6 +/**
  7 + * 线程池监听
  8 + * Created by panzhao on 2017/5/10.
  9 + */
  10 +@Component
  11 +public class ThreadPollMonitor extends Thread{
  12 +
  13 + @Override
  14 + public void run() {
  15 + long t = System.currentTimeMillis();
  16 +
  17 + if(t - GpsRealAnalyse.st > 3000 * 10){
  18 + GpsRealAnalyse.shutdown();
  19 + }
  20 + }
  21 +}
... ...
src/main/java/com/bsth/entity/schedule/temp/SchedulePlanRuleResult.java
... ... @@ -81,8 +81,8 @@ public class SchedulePlanRuleResult {
81 81 "(xl_id,xl_name,rule_id,cc_id,cc_zbh," +
82 82 "gids,gnames,gidindex,ecids,ecdbbms,ecindex," +
83 83 "ttinfo_id,ttinfo_name,schedule_date," +
84   - "sysuser_id,sysuser_name,create_date) " +
85   - "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  84 + "sysuser_id,sysuser_name,create_date, qyrq) " +
  85 + "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
86 86  
87 87 return sql;
88 88 }
... ... @@ -105,6 +105,8 @@ public class SchedulePlanRuleResult {
105 105 ps.setString(15, this.getSysuserId());
106 106 ps.setString(16, this.getSysuserName());
107 107 ps.setTimestamp(17, new java.sql.Timestamp(this.getCreateDate().getTime()));
  108 + ps.setDate(18, new java.sql.Date(this.getQyrq().getTime()));
  109 +
108 110  
109 111 }
110 112  
... ...
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
... ... @@ -407,7 +407,19 @@ public class FormsServiceImpl implements FormsService {
407 407  
408 408 rq = rq2 + "-" + rq3;
409 409  
410   - String sql = " select c.*,l.line_code from bsth_c_chtoch c LEFT JOIN bsth_c_line l on c.xl=l.name WHERE 1=1 ";
  410 + String line="";
  411 + if(map.get("line")!=null){
  412 + line=map.get("line").toString().trim();
  413 + }
  414 + String gs="";
  415 + if(map.get("gsdm")!=null){
  416 + gs=map.get("gsdm").toString();
  417 + }
  418 + String fgs="";
  419 + if(map.get("fgsdm")!=null){
  420 + fgs =map.get("fgsdm").toString();
  421 + }
  422 + /*String sql = " select c.*,l.line_code from bsth_c_chtoch c LEFT JOIN bsth_c_line l on c.xl=l.name WHERE 1=1 ";
411 423 if (!map.get("startDate").toString().equals(" ") && !map.get("endDate").toString().equals(" ")) {
412 424 sql += "and DATE_FORMAT( c.rq,'%Y-%m-%d') BETWEEN '" + map.get("startDate").toString() + "' and '"
413 425 + map.get("endDate").toString() + "'";
... ... @@ -419,18 +431,28 @@ public class FormsServiceImpl implements FormsService {
419 431 sql += " and c.pcch!=c.pcry";
420 432 } else if (map.get("sel").equals("1")) {
421 433 sql += " and c.jhgh!=c.sjgh";
422   - }
  434 + }*/
423 435  
  436 + String sql="select * from bsth_c_chtoch where rq BETWEEN '"+ map.get("startDate").toString()+"' "
  437 + + " and '"+map.get("endDate").toString() +"'";
  438 +
  439 + if(!line.equals("")){
  440 + sql +=" and xl= '"+line+"'";
  441 + }else{
  442 + sql += " and gs= '"+gs+"' and fgs= '"+fgs+"'";
  443 + }
  444 +
  445 + sql +=" order by rq";
424 446 List<Changetochange> list = jdbcTemplate.query(sql, new RowMapper<Changetochange>() {
425 447  
426 448  
427 449 @Override
428 450 public Changetochange mapRow(ResultSet arg0, int arg1) throws SQLException {
429 451 Changetochange chan = new Changetochange();
430   - chan.setRq(rq);
431   - chan.setGs(arg0.getString("gs"));
432   - chan.setFgs(arg0.getString("fgs"));
433   - chan.setXl(arg0.getString("xl"));
  452 + chan.setRq(arg0.getString("rq"));
  453 + chan.setGs(BasicData.businessCodeNameMap.get(arg0.getString("gs")));
  454 + chan.setFgs(BasicData.businessFgsCodeNameMap.get(arg0.getString("fgs")+"_"+arg0.getString("gs")));
  455 + chan.setXl(BasicData.lineCode2NameMap.get(arg0.getString("xl")));
434 456 chan.setLp(arg0.getString("lp"));
435 457 chan.setFssj(arg0.getString("fssj"));
436 458 chan.setXgsj(arg0.getString("xgsj"));
... ...
src/main/java/com/bsth/service/report/impl/CulateMileageServiceImpl.java
... ... @@ -558,7 +558,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
558 558 //有子任务
559 559 if (cts != null && cts.size() > 0) {
560 560 for(ChildTaskPlan c : cts){
561   - if(c.isDestroy() && c.getDestroyReason().equals(item))
  561 + if(c.isDestroy() && (c.getDestroyReason()==null?"": c.getDestroyReason()).equals(item))
562 562 sum = Arith.add(sum, c.getMileage());
563 563 }
564 564 }
... ...
src/main/java/com/bsth/service/schedule/SchedulePlanInfoService.java
... ... @@ -17,6 +17,13 @@ import java.util.List;
17 17 public interface SchedulePlanInfoService extends BService<SchedulePlanInfo, Long> {
18 18  
19 19 /**
  20 + * 查找最近的排班的日期。
  21 + * @param xlId 线路Id
  22 + * @return
  23 + */
  24 + List<Date> findLastestPlanDate(Integer xlId);
  25 +
  26 + /**
20 27 * 查找排班计划汇总数据。
21 28 * @param xlId 线路Id
22 29 * @param scheduleDate 排班时间
... ...
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
1 1 package com.bsth.service.schedule.impl;
2 2  
  3 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  4 +import com.bsth.entity.schedule.SchedulePlanInfo;
  5 +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  6 +import com.bsth.util.ReportUtils;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.jdbc.core.JdbcTemplate;
  9 +import org.springframework.jdbc.core.RowMapper;
  10 +import org.springframework.stereotype.Service;
  11 +
3 12 import java.math.BigDecimal;
4   -import java.net.URLEncoder;
5 13 import java.sql.ResultSet;
6 14 import java.sql.SQLException;
7 15 import java.text.DecimalFormat;
8 16 import java.text.NumberFormat;
9 17 import java.text.ParseException;
10 18 import java.text.SimpleDateFormat;
11   -import java.util.ArrayList;
12   -import java.util.Collections;
13   -import java.util.Date;
14   -import java.util.HashMap;
15   -import java.util.HashSet;
16   -import java.util.Iterator;
17   -import java.util.List;
18   -import java.util.Map;
19   -import java.util.Set;
  19 +import java.util.*;
  20 +
20 21  
21 22 import org.springframework.beans.factory.annotation.Autowired;
22 23 import org.springframework.jdbc.core.JdbcTemplate;
... ... @@ -761,7 +762,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
761 762 return modelMap;
762 763 }
763 764  
764   - @Override
  765 +// @Override
765 766 public Map<String, Object> scheduleAnaly_sum(Map<String, Object> map) {
766 767 DecimalFormat df = new DecimalFormat("00");
767 768 NumberFormat nf = NumberFormat.getNumberInstance();
... ... @@ -1296,7 +1297,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1296 1297 return resList;
1297 1298 }
1298 1299  
1299   - @Override
  1300 +// @Override
1300 1301 public List<Map<String, Object>> firstAndLastBus_sum(Map<String, Object> map) {
1301 1302 NumberFormat nf = NumberFormat.getNumberInstance();
1302 1303 nf.setMinimumFractionDigits(2);
... ...
src/main/java/com/bsth/service/schedule/impl/SchedulePlanInfoServiceImpl.java
... ... @@ -5,6 +5,7 @@ import com.bsth.repository.schedule.SchedulePlanInfoRepository;
5 5 import com.bsth.service.schedule.SchedulePlanInfoService;
6 6 import org.springframework.beans.factory.annotation.Autowired;
7 7 import org.springframework.jdbc.core.JdbcTemplate;
  8 +import org.springframework.jdbc.core.RowCallbackHandler;
8 9 import org.springframework.jdbc.core.RowMapper;
9 10 import org.springframework.stereotype.Service;
10 11 import org.springframework.transaction.annotation.Transactional;
... ... @@ -25,6 +26,26 @@ public class SchedulePlanInfoServiceImpl extends BServiceImpl&lt;SchedulePlanInfo,
25 26 private JdbcTemplate jdbcTemplate;
26 27  
27 28 @Override
  29 + public List<Date> findLastestPlanDate(Integer xlId) {
  30 + String sql = "select max(schedule_date) as sd from bsth_c_s_sp_info " +
  31 + "where xl = ?";
  32 +
  33 + final List<Date> ld = new ArrayList<>();
  34 +
  35 + jdbcTemplate.query(sql, new Object[]{xlId}, new RowCallbackHandler() {
  36 + @Override
  37 + public void processRow(ResultSet rs) throws SQLException {
  38 + if (rs != null && rs.getDate("sd") != null) {
  39 + ld.add(new Date(rs.getDate("sd").getTime()));
  40 + }
  41 + }
  42 + });
  43 +
  44 + return ld;
  45 +
  46 + }
  47 +
  48 + @Override
28 49 public List<SchedulePlanGroupInfo> findSchedulePlanGroupInfo(Integer xlId, Date scheduleDate) {
29 50 String sql = SchedulePlanGroupInfo.generateSelectSql();
30 51 List<SchedulePlanGroupInfo> schedulePlanGroupInfos = jdbcTemplate.query(sql, new Object[]{xlId, scheduleDate}, new RowMapper<SchedulePlanGroupInfo>() {
... ...
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
... ... @@ -28,6 +28,9 @@ import org.slf4j.Logger;
28 28 import org.slf4j.LoggerFactory;
29 29 import org.springframework.beans.factory.annotation.Autowired;
30 30 import org.springframework.stereotype.Service;
  31 +import org.springframework.transaction.annotation.Isolation;
  32 +import org.springframework.transaction.annotation.Propagation;
  33 +import org.springframework.transaction.annotation.Transactional;
31 34  
32 35 import java.util.*;
33 36  
... ... @@ -318,6 +321,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
318 321  
319 322 }
320 323  
  324 + @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED)
321 325 public SchedulePlan save(SchedulePlan schedulePlan) {
322 326 // pre、如果排班的数据之前已经有了,删除之前的数据
323 327 Date startpre = new Date();
... ...
src/main/resources/rules/validplan.drl 0 → 100644
  1 +// TODO:
0 2 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/mould/changetochange.xls
No preview for this file type
src/main/resources/static/pages/mforms/changetochanges/changetochange.html
... ... @@ -70,14 +70,14 @@
70 70 class="form-control" type="text" id="endDate"
71 71 style="width: 140px;" />
72 72 </div>
73   - <div style="display: inline-block; margin-left: 10px;">
74   - <span class="item-label" style="width: 120px;">类型: </span> <select
75   - class="form-control" id="sel">
76   - <option value="">请选择</option>
77   - <option value="1">换人</option>
78   - <option value="2">换车</option>
79   - </select>
80   - </div>
  73 +<!-- <div style="display: inline-block; margin-left: 10px;"> -->
  74 +<!-- <span class="item-label" style="width: 120px;">类型: </span> <select -->
  75 +<!-- class="form-control" id="sel"> -->
  76 +<!-- <option value="">请选择</option> -->
  77 +<!-- <option value="1">换人</option> -->
  78 +<!-- <option value="2">换车</option> -->
  79 +<!-- </select> -->
  80 +<!-- </div> -->
81 81 <div class="form-group">
82 82 <input class="btn btn-default" type="button" id="query" value="筛选" />
83 83 <input class="btn btn-default" type="button" id="export"
... ... @@ -117,10 +117,8 @@
117 117 <tr>
118 118 <td>车号</td>
119 119 <td>车号</td>
120   - <td>工号</td>
121   - <td>人员</td>
122   - <td>工号</td>
123   - <td>人员</td>
  120 + <td colspan="2">工号/人员</td>
  121 + <td colspan="2">工号/人员</td>
124 122 </tr>
125 123 </thead>
126 124 <tbody>
... ... @@ -188,6 +186,7 @@
188 186 $("#fgsdmChange").on("change",initXl);
189 187 function initXl(){
190 188 var data=[];
  189 + data.push({id: " ", text: "请选择"});
191 190 if(fage){
192 191 $("#line").select2("destroy").html('');
193 192 }
... ... @@ -223,29 +222,15 @@
223 222 var gsdmChange= $("#gsdmChange").val();
224 223 var fgsdmChange= $("#fgsdmChange").val();
225 224 if (startDate1 != '' && endDate1 != '') {
226   - $post('/mcy_forms/changetochange', {
  225 + $get('/mcy_forms/changetochange', {
227 226 sel : sel,
228 227 line : line,
229 228 startDate : $("#startDate").val(),
230 229 endDate : $("#endDate").val(),
  230 + gsdm:gsdmChange,
  231 + fgsdm:fgsdmChange,
231 232 type : 'query'
232 233 }, function(result) {
233   - startDate = $("#startDate").val();
234   - endDate = $("#endDate").val();
235   - $("#sDate").text(startDate);
236   - $("#eDate").text(endDate);
237   - var temp = {};
238   - var today_account = 0;
239   - temp["line"] = $("#line").text();
240   - $.each(result, function(i, obj) {
241   - if (moment(obj.schedule_date_str).format(
242   - "YYYY-MM-DD") == moment(obj.startDate)
243   - .format("YYYY-MM-DD")) {
244   - today_account++;
245   - }
246   - obj.updateDate = moment(obj.startDate).format(
247   - "YYYY-MM-DD HH:mm:ss");
248   - });
249 234 // 把数据填充到模版中
250 235 var tbodyHtml = template('changetochange', {
251 236 list : result
... ... @@ -294,11 +279,9 @@
294 279 <td>{{obj.fssj}}</td>
295 280 <td>{{obj.xgsj}}</td>
296 281 <td>{{obj.pcch}}</td>
297   - <td>{{obj.pcry}}</td>
298   - <td>{{obj.jhgh}}</td>
299   - <td>{{obj.jhch}}</td>
300   - <td>{{obj.sjgh}}</td>
301 282 <td>{{obj.sjch}}</td>
  283 + <td colspan="2">{{obj.pcry}}</td>
  284 + <td colspan="2">{{obj.sjgh}}</td>
302 285 <td>{{obj.yy}}</td>
303 286 <td>{{obj.xgr}}</td>
304 287 </tr>
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
... ... @@ -548,6 +548,24 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;SchedulePlanInfoManageService_g&#39;, [&#39;$reso
548 548 }
549 549 }
550 550 }
  551 + ),
  552 + latestsd: $resource(
  553 + '/spic/lastestsd/:xlid',
  554 + {},
  555 + {
  556 + list: {
  557 + method: 'GET',
  558 + isArray: true,
  559 + transformResponse: function(rs) {
  560 + var dst = angular.fromJson(rs);
  561 + if (dst.status == 'SUCCESS') {
  562 + return dst.data;
  563 + } else {
  564 + return dst; // 业务错误留给控制器处理
  565 + }
  566 + }
  567 + }
  568 + }
551 569 )
552 570  
553 571  
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/report/ext/list.html
1 1 <!-- ui-route employeeInfoManage.list -->
2 2 <div ng-controller="SchedulePlanReportExtManageListCtrl as ctrl">
  3 +
  4 + <div class="portlet">
  5 + <div class="portlet-title">
  6 + <div class="caption caption-subject font-red-sunglo bold uppercase">
  7 + 最近排班至
  8 + <span ng-bind="ctrl.lsd | date: 'yyyy年MM月dd日'">
  9 + </span>
  10 + </div>
  11 + </div>
  12 + </div>
  13 +
3 14 <div class="fixDiv">
4 15 <table class="fixTable table table-striped table-bordered table-hover table-checkable order-column"
5 16 style="width: 1800px; min-height: 500px;">
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/report/ext/module.js
... ... @@ -46,6 +46,15 @@ angular.module(&#39;ScheduleApp&#39;).factory(
46 46 },
47 47  
48 48 /**
  49 + * 查询线路最近排班日期。
  50 + * @param xlid
  51 + */
  52 + getLastestsd: function() {
  53 + var params = currentSearchCondition; // 查询条件
  54 + return service.latestsd.list(params).$promise;
  55 + },
  56 +
  57 + /**
49 58 * 批量保存排班明细。
50 59 * @param rs
51 60 */
... ... @@ -168,6 +177,8 @@ angular.module(&#39;ScheduleApp&#39;).controller(
168 177 return service.resetSearchCondition();
169 178 };
170 179  
  180 + self.lsd;
  181 +
171 182 // 监控条件变化,触发查询
172 183 $scope.$watch(
173 184 function() {
... ... @@ -175,6 +186,22 @@ angular.module(&#39;ScheduleApp&#39;).controller(
175 186 },
176 187 function(newValue, oldValue) {
177 188 if (newValue) {
  189 + if (newValue.xlid) {
  190 + service.getLastestsd().then(
  191 + function(result) {
  192 + if (result.length > 0) {
  193 + self.lsd = new Date();
  194 + self.lsd.setTime(result[0]);
  195 + } else {
  196 + self.lsd = "暂无排班";
  197 + }
  198 +
  199 + },
  200 + function() {
  201 + }
  202 + );
  203 + }
  204 +
178 205 if (newValue.xlid && newValue.sdate) {
179 206 self.pageChanaged();
180 207 }
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/service.js
... ... @@ -126,6 +126,24 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;SchedulePlanInfoManageService_g&#39;, [&#39;$reso
126 126 }
127 127 }
128 128 }
  129 + ),
  130 + latestsd: $resource(
  131 + '/spic/lastestsd/:xlid',
  132 + {},
  133 + {
  134 + list: {
  135 + method: 'GET',
  136 + isArray: true,
  137 + transformResponse: function(rs) {
  138 + var dst = angular.fromJson(rs);
  139 + if (dst.status == 'SUCCESS') {
  140 + return dst.data;
  141 + } else {
  142 + return dst; // 业务错误留给控制器处理
  143 + }
  144 + }
  145 + }
  146 + }
129 147 )
130 148  
131 149  
... ...
src/test/resources/testdata/problem.properties
... ... @@ -14,7 +14,7 @@
14 14 14=路牌编号自动生成
15 15 15=时刻表导入的时候表头后面不需要加数字
16 16 ##16=时间框中文
17   -17=人员工号前公司编码自动加
  17 +##17=人员工号前公司编码自动加
18 18 18=排班计划明细可以修改(修改到每个班次)
19 19 19=线路运营概览
20 20 20=排班规则备注
... ... @@ -31,3 +31,4 @@
31 31 ##30=时刻表公里数 三位数
32 32  
33 33 31=规则修改,路牌范围,人员范围可以拖动
  34 +32=人员配置不存在的情况下,导入规则ktr,找不到的人员不添加,人员范围不存在的,规则不导入
... ...