Commit e7a91a12f51901d14dd1f7755476d8bd8ae9c20a

Authored by 徐烜
1 parent 0510497d

Update

src/main/java/com/bsth/controller/schedule/core/SchedulePlanController.java
1 1 package com.bsth.controller.schedule.core;
2 2  
3   -import com.bsth.common.Constants;
4 3 import com.bsth.common.ResponseCode;
5 4 import com.bsth.controller.schedule.BController;
6 5 import com.bsth.entity.schedule.SchedulePlan;
7   -import com.bsth.entity.sys.CompanyAuthority;
8   -import com.bsth.entity.sys.SysUser;
9 6 import com.bsth.service.schedule.SchedulePlanService;
10   -import com.bsth.service.sys.SysUserService;
11 7 import org.springframework.beans.factory.annotation.Autowired;
12   -import org.springframework.web.bind.annotation.*;
  8 +import org.springframework.web.bind.annotation.PathVariable;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestMethod;
  11 +import org.springframework.web.bind.annotation.RestController;
13 12  
14   -import javax.servlet.http.HttpSession;
15 13 import java.util.Date;
16 14 import java.util.HashMap;
17   -import java.util.List;
18 15 import java.util.Map;
19 16  
20 17 /**
... ... @@ -25,33 +22,6 @@ import java.util.Map;
25 22 public class SchedulePlanController extends BController<SchedulePlan, Long> {
26 23 @Autowired
27 24 private SchedulePlanService schedulePlanService;
28   - @Autowired
29   - private SysUserService sysUserService;
30   -
31   - @Override
32   - public Map<String, Object> save(@RequestBody SchedulePlan schedulePlan, HttpSession httpSession) {
33   - // 用户信息
34   - String userName = String.valueOf(httpSession.getAttribute(Constants.SESSION_USERNAME));
35   - SysUser sysUser = sysUserService.findByUserName(userName);
36   -
37   - Date cdate = new Date();
38   - schedulePlan.setCreateBy(sysUser);
39   - schedulePlan.setCreateDate(cdate);
40   - schedulePlan.setUpdateBy(sysUser);
41   - schedulePlan.setUpdateDate(cdate);
42   -
43   - // 如果多个公司,选第一个,以后改成页面控制
44   - List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) httpSession.getAttribute(Constants.COMPANY_AUTHORITYS);
45   - if (cmyAuths == null || cmyAuths.size() == 0)
46   - schedulePlanService.save(schedulePlan, new CompanyAuthority());
47   - else
48   - schedulePlanService.save(schedulePlan, cmyAuths.get(0));
49   -
50   - Map<String, Object> rtn = new HashMap<>();
51   - rtn.put("status", ResponseCode.SUCCESS);
52   - rtn.put("data", new Object());
53   - return rtn;
54   - }
55 25  
56 26 /**
57 27 * 获取明天的一歌排班计划。
... ...
src/main/java/com/bsth/repository/schedule/SchedulePlanInfoRepository.java
... ... @@ -27,27 +27,29 @@ public interface SchedulePlanInfoRepository extends BaseRepository&lt;SchedulePlanI
27 27 Long deleteByXlAndScheduleDateGreaterThanEqualAndScheduleDateLessThanEqual(Integer xlid, Date startDate, Date endDate);
28 28  
29 29 @Query(value = " select " +
30   - "xl as xlId, " +
31   - "xl_name as xlName, " +
32   - "schedule_date as scheduleDate, " +
33   - "lp_name as lpName, " +
34   - "cl as clId, " +
35   - "cl_zbh as clZbh, " +
36   - "group_concat(fcsj) ccsj, " +
37   - "group_concat(bc_type) bctype, " +
38   - "group_concat(distinct j) jsyId, " +
39   - "group_concat(distinct j_gh) jsyGh, " +
40   - "group_concat(distinct j_name) jsyName, " +
41   - "group_concat(distinct s) spyId, " +
42   - "group_concat(distinct s_gh) spyGh, " +
43   - "group_concat(distinct s_name) spyName, " +
44   - "max(create_date) as createDate, " +
45   - "group_concat(fcno) fcno " +
46   - "from bsth_c_s_sp_info " +
47   - "where xl = ?1 and " +
48   - "schedule_date = ?2 " +
49   - "group by xl_name, schedule_date, lp, lp_name, cl, cl_zbh " +
50   - "order by xl_name, schedule_date, lp ", nativeQuery = true)
  30 + "info.xl as xlId, " +
  31 + "info.xl_name as xlName, " +
  32 + "info.schedule_date as scheduleDate, " +
  33 + "info.lp_name as lpName, " +
  34 + "info.cl as clId, " +
  35 + "info.cl_zbh as clZbh, " +
  36 + "group_concat(info.fcsj) ccsj, " +
  37 + "group_concat(info.bc_type) bctype, " +
  38 + "group_concat(distinct info.j) jsyId, " +
  39 + "group_concat(distinct info.j_gh) jsyGh, " +
  40 + "group_concat(distinct info.j_name) jsyName, " +
  41 + "group_concat(distinct info.s) spyId, " +
  42 + "group_concat(distinct info.s_gh) spyGh, " +
  43 + "group_concat(distinct info.s_name) spyName, " +
  44 + "group_concat(info.fcno) fcno, " +
  45 + "max(info.update_date) as updateDate, " +
  46 + "max(user.name) as updateUserName, " +
  47 + "max(info.tt_info_name) as ttInfoName " +
  48 + "from bsth_c_s_sp_info info left join bsth_c_sys_user user on info.update_by = user.id " +
  49 + "where info.xl = ?1 and " +
  50 + "info.schedule_date = ?2 " +
  51 + "group by info.xl_name, info.schedule_date, info.lp, info.lp_name, info.cl, info.cl_zbh " +
  52 + "order by info.xl_name, info.schedule_date, info.lp ", nativeQuery = true)
51 53 List<Object[]> findGroupInfo(Integer xlid, Date scheduleDate);
52 54  
53 55 @Modifying
... ...
src/main/java/com/bsth/service/schedule/SchedulePlanInfoService.java
... ... @@ -115,8 +115,12 @@ public interface SchedulePlanInfoService extends BaseService&lt;SchedulePlanInfo, L
115 115 /** 售票员1姓名 */
116 116 private String spy2Name;
117 117  
118   - /** 创建时间 */
119   - private Date createDate;
  118 + /** 修改时间 */
  119 + private Date updateDate;
  120 + /** 修改人名 */
  121 + private String updateByName;
  122 + /** 时刻表名字 */
  123 + private String ttInfoName;
120 124  
121 125 /** 出场班次1发车的顺序号 */
122 126 private Integer fcno1;
... ... @@ -141,7 +145,7 @@ public interface SchedulePlanInfoService extends BaseService&lt;SchedulePlanInfo, L
141 145 // 出场时间,出场班次,如果有多个,需要分开
142 146 Object ccsj = datas[6];
143 147 Object bctype = datas[7];
144   - Object fcno = datas[15];
  148 + Object fcno = datas[14];
145 149  
146 150 if (ccsj != null) {
147 151 String[] ccsj_array = ((String) ccsj).split(",");
... ... @@ -238,12 +242,32 @@ public interface SchedulePlanInfoService extends BaseService&lt;SchedulePlanInfo, L
238 242 this.spy1Name = String.valueOf(spyName_array[0]);
239 243 }
240 244 }
241   - // 创建时间
242   - this.createDate = new DateTime(datas[14]).toDate();
  245 + // 修改时间
  246 + this.updateDate = new DateTime(datas[15]).toDate();
  247 + // 修改人
  248 + this.updateByName = String.valueOf(datas[16]);
  249 + // 时刻表名字
  250 + this.ttInfoName = String.valueOf(datas[17]);
243 251  
244 252 // TODO:可能还有其他字段
245 253 }
246 254  
  255 + public Date getUpdateDate() {
  256 + return updateDate;
  257 + }
  258 +
  259 + public void setUpdateDate(Date updateDate) {
  260 + this.updateDate = updateDate;
  261 + }
  262 +
  263 + public String getUpdateByName() {
  264 + return updateByName;
  265 + }
  266 +
  267 + public void setUpdateByName(String updateByName) {
  268 + this.updateByName = updateByName;
  269 + }
  270 +
247 271 public String getXlName() {
248 272 return xlName;
249 273 }
... ... @@ -396,14 +420,6 @@ public interface SchedulePlanInfoService extends BaseService&lt;SchedulePlanInfo, L
396 420 this.spy2Name = spy2Name;
397 421 }
398 422  
399   - public Date getCreateDate() {
400   - return createDate;
401   - }
402   -
403   - public void setCreateDate(Date createDate) {
404   - this.createDate = createDate;
405   - }
406   -
407 423 public Integer getXlId() {
408 424 return xlId;
409 425 }
... ... @@ -427,5 +443,13 @@ public interface SchedulePlanInfoService extends BaseService&lt;SchedulePlanInfo, L
427 443 public void setFcno2(Integer fcno2) {
428 444 this.fcno2 = fcno2;
429 445 }
  446 +
  447 + public String getTtInfoName() {
  448 + return ttInfoName;
  449 + }
  450 +
  451 + public void setTtInfoName(String ttInfoName) {
  452 + this.ttInfoName = ttInfoName;
  453 + }
430 454 }
431 455 }
... ...
src/main/java/com/bsth/service/schedule/SchedulePlanService.java
1 1 package com.bsth.service.schedule;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlan;
4   -import com.bsth.entity.sys.CompanyAuthority;
5 4 import com.bsth.service.schedule.rules.ttinfo2.Result;
6 5  
7 6 import java.util.Date;
... ... @@ -11,7 +10,7 @@ import java.util.Date;
11 10 */
12 11 public interface SchedulePlanService extends BService<SchedulePlan, Long> {
13 12  
14   - SchedulePlan save(SchedulePlan schedulePlan, CompanyAuthority companyAuthority);
  13 + SchedulePlan save(SchedulePlan schedulePlan);
15 14  
16 15 /**
17 16 * 获取有明日排班的计划。
... ...
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
1 1 package com.bsth.service.schedule.impl;
2 2  
  3 +import com.bsth.entity.Business;
3 4 import com.bsth.entity.Line;
4 5 import com.bsth.entity.schedule.*;
5 6 import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
6   -import com.bsth.entity.sys.CompanyAuthority;
7 7 import com.bsth.repository.schedule.SchedulePlanInfoRepository;
8 8 import com.bsth.repository.schedule.SchedulePlanRepository;
  9 +import com.bsth.service.BusinessService;
9 10 import com.bsth.service.LineService;
10 11 import com.bsth.service.schedule.SchedulePlanService;
11 12 import com.bsth.service.schedule.TTInfoDetailService;
... ... @@ -51,12 +52,14 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
51 52 private TTInfoService ttInfoService;
52 53 @Autowired
53 54 private TTInfoDetailService ttInfoDetailService;
  55 + @Autowired
  56 + private BusinessService businessService;
54 57  
55 58 /** 日志记录器 */
56 59 private Logger logger = LoggerFactory.getLogger(SchedulePlanServiceImpl.class);
57 60  
58 61 @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED)
59   - public SchedulePlan save(SchedulePlan schedulePlan, CompanyAuthority companyAuthority) {
  62 + public SchedulePlan save(SchedulePlan schedulePlan) {
60 63 // 1-1、查找线路具体信息
61 64 Line xl = strategy.getLine(schedulePlan.getXl().getId());
62 65 // 1-2、查出指定线路的所有规则
... ... @@ -149,11 +152,46 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
149 152 employeeConfigInfoList,
150 153 schedulePlan);
151 154  
152   - // 公司,分公司编码
153   - schedulePlanInfo.setGsBm(companyAuthority.getCompanyCode());
154   - schedulePlanInfo.setGsName(companyAuthority.getCompanyName());
155   - schedulePlanInfo.setFgsBm(companyAuthority.getSubCompanyCode());
156   - schedulePlanInfo.setFgsName(companyAuthority.getSubCompanyName());
  155 + // 获取公司,分公司信息
  156 + String gsbm = xl.getCompany();
  157 + String fgsbm = xl.getBrancheCompany();
  158 + Business gs = null;
  159 + Business fgs = null;
  160 +
  161 + Map<String, Object> param = new HashMap<>();
  162 +
  163 + if (StringUtils.isNotEmpty(gsbm)) {
  164 + param.clear();
  165 + param.put("businessCode_eq", gsbm);
  166 + Iterator<Business> businessIterator = businessService.list(param).iterator();
  167 + if (businessIterator.hasNext()) {
  168 + gs = businessIterator.next();
  169 + }
  170 + }
  171 + if (StringUtils.isNotEmpty(gsbm) && StringUtils.isNotEmpty(fgsbm)) {
  172 + param.clear();;
  173 + param.put("upCode_eq", gsbm);
  174 + param.put("businessCode_eq", fgsbm);
  175 + Iterator<Business> businessIterator = businessService.list(param).iterator();
  176 + if (businessIterator.hasNext()) {
  177 + fgs = businessIterator.next();
  178 + }
  179 + }
  180 +
  181 + if (gs != null) {
  182 + schedulePlanInfo.setGsBm(gs.getBusinessCode());
  183 + schedulePlanInfo.setGsName(gs.getBusinessName());
  184 + }
  185 + if (fgs != null) {
  186 + schedulePlanInfo.setFgsBm(fgs.getBusinessCode());
  187 + schedulePlanInfo.setFgsName(fgs.getBusinessName());
  188 + }
  189 +
  190 + // 操作人,操作时间
  191 + schedulePlanInfo.setCreateBy(schedulePlan.getCreateBy());
  192 + schedulePlanInfo.setCreateDate(schedulePlan.getCreateDate());
  193 + schedulePlanInfo.setUpdateBy(schedulePlan.getUpdateBy());
  194 + schedulePlanInfo.setUpdateDate(schedulePlan.getUpdateDate());
157 195  
158 196 schedulePlanInfos.add(schedulePlanInfo);
159 197 ttInfoMap.put(ttInfoDetail.getTtinfo().getId(), ttInfoDetail.getTtinfo().getName());
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/info/list_info.html
... ... @@ -5,16 +5,18 @@
5 5 <thead>
6 6 <tr role="row" class="heading">
7 7 <th style="width: 50px;">序号</th>
8   - <th style="width: 100px;">线路</th>
  8 + <th style="width: 80px;">线路</th>
9 9 <th style="width: 150px;">日期</th>
10   - <th style="width: 60px;">路牌</th>
11   - <th style="width: 150px;">车辆</th>
12   - <th style="width: 150px;">驾驶员(工号)</th>
13   - <th style="width: 150px;">售票员(工号)</th>
  10 + <th style="width: 50px;">路牌</th>
  11 + <th style="width: 120px;">车辆</th>
  12 + <th style="width: 120px;">驾驶员(工号)</th>
  13 + <th style="width: 120px;">售票员(工号)</th>
14 14 <th style="width: 80px;">班次类型</th>
15 15 <th style="width: 80px;">上下行</th>
16 16 <th style="width: 80px;">发车时间</th>
17 17 <th style="width: 100%">时刻表</th>
  18 + <th style="width: 90px;">修改人</th>
  19 + <th style="width: 90px;">修改时间</th>
18 20  
19 21 <!-- TODO:还有其他的 -->
20 22  
... ... @@ -44,6 +46,8 @@
44 46 <td></td>
45 47 <td></td>
46 48 <td></td>
  49 + <td></td>
  50 + <td></td>
47 51  
48 52 </tr>
49 53 </thead>
... ... @@ -82,7 +86,13 @@
82 86 <span ng-bind="info.fcsj"></span>
83 87 </td>
84 88 <td>
85   - <abbr title="{{info.ttInfoName}}"><span>{{info.ttInfoName}}</span></abbr>
  89 + <span ng-bind="info.ttInfoName"></span>
  90 + </td>
  91 + <td>
  92 + <span ng-bind="info.updateBy.name"></span>
  93 + </td>
  94 + <td>
  95 + <span ng-bind="info.updateDate | date: 'yyyy-MM-dd'"></span>
86 96 </td>
87 97  
88 98 </tr>
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/report/list_report.html
... ... @@ -19,8 +19,9 @@
19 19 <th style="width: 100px;">驾2</th>
20 20 <th style="width: 100px;">售工2</th>
21 21 <th style="width: 100px;">售2</th>
22   - <th style="width: 150px;">排班时间</th>
23 22 <th>时刻表</th>
  23 + <th style="width: 150px;">修改时间</th>
  24 + <th style="width: 100px;">修改人</th>
24 25 </tr>
25 26 <tr role="row" class="filter">
26 27 <td></td>
... ... @@ -62,6 +63,7 @@
62 63 <td></td>
63 64 <td></td>
64 65 <td></td>
  66 + <td></td>
65 67 </tr>
66 68 </thead>
67 69 <tbody>
... ... @@ -134,11 +136,15 @@
134 136 </a>
135 137 </td>
136 138 <td>
137   - <span ng-bind="info.createDate | date: 'yyyy-MM-dd HH:mm:ss'"></span>
  139 + <span ng-bind="info.ttInfoName"></span>
  140 + </td>
  141 + <td>
  142 + <span ng-bind="info.updateDate | date: 'yyyy-MM-dd HH:mm:ss'"></span>
138 143 </td>
139 144 <td>
140   - <span ng-bind="info.ttinfoName"></span>
  145 + <span ng-bind="info.updateByName"></span>
141 146 </td>
  147 +
142 148 </tr>
143 149 </tbody>
144 150 </table>
... ...