Commit 6e93dfe89c75dfb0bd74aaf60def11e9974a23ce

Authored by 廖磊
2 parents 817be1e8 ae3c4d66

Merge branch 'minhang' of 192.168.168.201:panzhaov5/bsth_control into

minhang
Showing 66 changed files with 1815 additions and 1355 deletions

Too many changes to show.

To preserve performance only 66 of 92 files are displayed.

src/main/java/com/bsth/controller/schedule/BController.java
1 1 package com.bsth.controller.schedule;
2 2  
  3 +import com.bsth.common.Constants;
3 4 import com.bsth.common.ResponseCode;
  5 +import com.bsth.entity.schedule.BEntity;
  6 +import com.bsth.entity.sys.SysUser;
4 7 import com.bsth.service.schedule.BService;
5 8 import com.bsth.service.schedule.ScheduleException;
  9 +import com.bsth.service.sys.SysUserService;
6 10 import com.google.common.base.Splitter;
7 11 import org.springframework.beans.factory.annotation.Autowired;
8 12 import org.springframework.data.domain.PageRequest;
9 13 import org.springframework.data.domain.Sort;
10 14 import org.springframework.web.bind.annotation.*;
11 15  
  16 +import javax.servlet.http.HttpSession;
12 17 import java.io.Serializable;
13   -import java.util.ArrayList;
14   -import java.util.HashMap;
15   -import java.util.List;
16   -import java.util.Map;
  18 +import java.util.*;
17 19  
18 20 /**
19 21 * 基础控制器。
... ... @@ -21,12 +23,24 @@ import java.util.Map;
21 23 public class BController<T, ID extends Serializable> {
22 24 @Autowired
23 25 protected BService<T, ID> bService;
  26 + @Autowired
  27 + private SysUserService sysUserService;
24 28  
25 29 // CRUD 操作
26 30 // Create操作
27 31 @RequestMapping(method = RequestMethod.POST)
28   - public Map<String, Object> save(@RequestBody T t) {
29   - T t_saved = bService.save(t);
  32 + public Map<String, Object> save(@RequestBody T t, HttpSession httpSession) {
  33 + // 判定T是否是BEntity的子类,增加新的字段
  34 + String userName = String.valueOf(httpSession.getAttribute(Constants.SESSION_USERNAME));
  35 + SysUser sysUser = sysUserService.findByUserName(userName);
  36 + BEntity t_b = null;
  37 + if (t instanceof BEntity) {
  38 + t_b = (BEntity) t;
  39 + t_b.setCreateBy(sysUser);
  40 + t_b.setCreateDate(new Date());
  41 + }
  42 +
  43 + T t_saved = bService.save(t_b == null ? t : (T) t_b);
30 44 Map<String, Object> rtn = new HashMap<>();
31 45 rtn.put("status", ResponseCode.SUCCESS);
32 46 rtn.put("data", t_saved);
... ... @@ -34,8 +48,21 @@ public class BController&lt;T, ID extends Serializable&gt; {
34 48 }
35 49 // Update操作
36 50 @RequestMapping(value="/{id}", method = RequestMethod.POST)
37   - public Map<String, Object> update(@RequestBody T t) {
38   - return save(t);
  51 + public Map<String, Object> update(@RequestBody T t, HttpSession httpSession) {
  52 + String userName = String.valueOf(httpSession.getAttribute(Constants.SESSION_USERNAME));
  53 + SysUser sysUser = sysUserService.findByUserName(userName);
  54 + BEntity t_b = null;
  55 + if (t instanceof BEntity) {
  56 + t_b = (BEntity) t;
  57 + t_b.setUpdateBy(sysUser);
  58 + t_b.setUpdateDate(new Date());
  59 + }
  60 +
  61 + T t_updated = bService.save(t_b == null ? t : (T) t_b);
  62 + Map<String, Object> rtn = new HashMap<>();
  63 + rtn.put("status", ResponseCode.SUCCESS);
  64 + rtn.put("data", t_updated);
  65 + return rtn;
39 66 }
40 67 // Research操作
41 68 @RequestMapping(value = "/{id}", method = RequestMethod.GET)
... ... @@ -97,9 +124,10 @@ public class BController&lt;T, ID extends Serializable&gt; {
97 124  
98 125 // Delete操作
99 126 @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
100   - public Map<String, Object> delete(@PathVariable("id") ID id) {
  127 + public Map<String, Object> delete(@PathVariable("id") ID id, HttpSession httpSession) {
101 128 Map<String, Object> rtn = new HashMap<>();
102 129 try {
  130 + // 由于种种原因,这里不保存用户和操作时间了
103 131 bService.delete(id);
104 132 rtn.put("status", ResponseCode.SUCCESS);
105 133 } catch (ScheduleException exp) {
... ...
src/main/java/com/bsth/controller/schedule/basicinfo/CarDeviceController.java 0 → 100644
  1 +package com.bsth.controller.schedule.basicinfo;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.controller.schedule.BController;
  5 +import com.bsth.entity.CarDevice;
  6 +import com.bsth.service.schedule.CarDeviceService;
  7 +import com.bsth.service.schedule.ScheduleException;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestMethod;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +
  14 +import java.util.HashMap;
  15 +import java.util.Map;
  16 +
  17 +/**
  18 + * Created by xu on 16/12/15.
  19 + */
  20 +@RestController(value = "carDeviceController_sc")
  21 +@RequestMapping("cde_sc")
  22 +public class CarDeviceController extends BController<CarDevice, Long> {
  23 + @Autowired
  24 + private CarDeviceService carDeviceService;
  25 +
  26 + @RequestMapping(value = "/validate_qyrq", method = RequestMethod.GET)
  27 + public Map<String, Object> validate_qyrq(@RequestParam Map<String, Object> param) {
  28 + Map<String, Object> rtn = new HashMap<>();
  29 +
  30 + try {
  31 + // 启用日期验证
  32 + CarDevice carDevice = new CarDevice(
  33 + param.get("id_eq"),
  34 + param.get("xl_eq"),
  35 + param.get("cl_eq"),
  36 + param.get("qyrq_eq")
  37 + );
  38 + carDeviceService.validate_qyrq(carDevice);
  39 + rtn.put("status", ResponseCode.SUCCESS);
  40 + } catch (ScheduleException exp) {
  41 + rtn.put("status", ResponseCode.ERROR);
  42 + rtn.put("msg", exp.getMessage());
  43 + }
  44 +
  45 + return rtn;
  46 + }
  47 +
  48 +}
... ...
src/main/java/com/bsth/controller/schedule/basicinfo/EmployeeController.java 0 → 100644
  1 +package com.bsth.controller.schedule.basicinfo;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.controller.schedule.BController;
  5 +import com.bsth.entity.Personnel;
  6 +import com.bsth.service.schedule.EmployeeService;
  7 +import com.bsth.service.schedule.ScheduleException;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestMethod;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +
  14 +import java.util.HashMap;
  15 +import java.util.Map;
  16 +
  17 +/**
  18 + * 人员基础信息Controller
  19 + */
  20 +@RestController
  21 +@RequestMapping("ee")
  22 +public class EmployeeController extends BController<Personnel, Integer> {
  23 + @Autowired
  24 + private EmployeeService employeeService;
  25 +
  26 + @RequestMapping(value = "/validate_gh", method = RequestMethod.GET)
  27 + public Map<String, Object> validate_gh(@RequestParam Map<String, Object> param) {
  28 + Map<String, Object> rtn = new HashMap<>();
  29 + try {
  30 + // 工号验证
  31 + Personnel personnel = new Personnel(
  32 + param.get("id_eq"),
  33 + param.get("companyCode_eq"),
  34 + param.get("jobCode_eq")
  35 + );
  36 + employeeService.validate_gh(personnel);
  37 + rtn.put("status", ResponseCode.SUCCESS);
  38 + } catch (ScheduleException exp) {
  39 + rtn.put("status", ResponseCode.ERROR);
  40 + rtn.put("msg", exp.getMessage());
  41 + }
  42 +
  43 + return rtn;
  44 + }
  45 +}
... ...
src/main/java/com/bsth/controller/schedule/core/GuideboardInfoController.java
... ... @@ -48,8 +48,8 @@ public class GuideboardInfoController extends BController&lt;GuideboardInfo, Long&gt;
48 48 return guideboardInfoRepository.findLpName(ttid);
49 49 }
50 50  
51   - @RequestMapping(value = "/validate1", method = RequestMethod.GET)
52   - public Map<String, Object> validate1(@RequestParam Map<String, Object> param) {
  51 + @RequestMapping(value = "/validate_lpno", method = RequestMethod.GET)
  52 + public Map<String, Object> validate_lpno(@RequestParam Map<String, Object> param) {
53 53 Map<String, Object> rtn = new HashMap<>();
54 54 try {
55 55 // 路牌编号验证
... ... @@ -59,7 +59,7 @@ public class GuideboardInfoController extends BController&lt;GuideboardInfo, Long&gt;
59 59 param.get("lpNo_eq"),
60 60 null
61 61 );
62   - guideboardInfoService.validate(guideboardInfo);
  62 + guideboardInfoService.validate_lpno(guideboardInfo);
63 63 rtn.put("status", ResponseCode.SUCCESS);
64 64 } catch (ScheduleException exp) {
65 65 rtn.put("status", ResponseCode.ERROR);
... ... @@ -68,8 +68,8 @@ public class GuideboardInfoController extends BController&lt;GuideboardInfo, Long&gt;
68 68 return rtn;
69 69 }
70 70  
71   - @RequestMapping(value = "/validate2", method = RequestMethod.GET)
72   - public Map<String, Object> validate2(@RequestParam Map<String, Object> param) {
  71 + @RequestMapping(value = "/validate_lpname", method = RequestMethod.GET)
  72 + public Map<String, Object> validate_lpname(@RequestParam Map<String, Object> param) {
73 73 Map<String, Object> rtn = new HashMap<>();
74 74 try {
75 75 // 路牌名称验证
... ... @@ -79,7 +79,7 @@ public class GuideboardInfoController extends BController&lt;GuideboardInfo, Long&gt;
79 79 null,
80 80 param.get("lpName_eq")
81 81 );
82   - guideboardInfoService.validate(guideboardInfo);
  82 + guideboardInfoService.validate_lpname(guideboardInfo);
83 83 rtn.put("status", ResponseCode.SUCCESS);
84 84 } catch (ScheduleException exp) {
85 85 rtn.put("status", ResponseCode.ERROR);
... ...
src/main/java/com/bsth/data/forecast/ForecastRealServer.java
1 1 package com.bsth.data.forecast;
2 2  
3   -import java.text.DecimalFormat;
4   -import java.util.ArrayList;
5   -import java.util.HashMap;
6   -import java.util.List;
7   -import java.util.Map;
8   -import java.util.concurrent.TimeUnit;
9   -
10   -import org.slf4j.Logger;
11   -import org.slf4j.LoggerFactory;
12   -import org.springframework.beans.factory.annotation.Autowired;
13   -import org.springframework.boot.CommandLineRunner;
14   -import org.springframework.stereotype.Component;
15   -
16   -import com.bsth.Application;
17 3 import com.bsth.data.forecast.entity.ForecastResult;
18 4 import com.bsth.data.forecast.entity.ForecastResult.ForecastResultItem;
19 5 import com.bsth.data.forecast.entity.SimpleRoute;
... ... @@ -23,6 +9,17 @@ import com.bsth.data.gpsdata.GpsRealData;
23 9 import com.bsth.data.schedule.DayOfSchedule;
24 10 import com.bsth.entity.realcontrol.ScheduleRealInfo;
25 11 import com.google.common.collect.ArrayListMultimap;
  12 +import org.slf4j.Logger;
  13 +import org.slf4j.LoggerFactory;
  14 +import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.boot.CommandLineRunner;
  16 +import org.springframework.stereotype.Component;
  17 +
  18 +import java.text.DecimalFormat;
  19 +import java.util.ArrayList;
  20 +import java.util.HashMap;
  21 +import java.util.List;
  22 +import java.util.Map;
26 23  
27 24 /**
28 25 *
... ... @@ -61,7 +58,7 @@ public class ForecastRealServer implements CommandLineRunner {
61 58 @Override
62 59 public void run(String... arg0) throws Exception {
63 60 //2小时更新一次站点间耗时数据
64   -// Application.mainServices.scheduleWithFixedDelay(dataLoader, 12, 120 * 60, TimeUnit.SECONDS);
  61 + //Application.mainServices.scheduleWithFixedDelay(dataLoader, 12, 120 * 60, TimeUnit.SECONDS);
65 62 }
66 63  
67 64 /**
... ...
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
... ... @@ -3,6 +3,7 @@ package com.bsth.data.schedule;
3 3 import com.bsth.data.LineConfigData;
4 4 import com.bsth.entity.realcontrol.LineConfig;
5 5 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  6 +import org.apache.commons.lang3.StringUtils;
6 7 import org.joda.time.format.DateTimeFormat;
7 8 import org.joda.time.format.DateTimeFormatter;
8 9 import org.slf4j.Logger;
... ... @@ -115,8 +116,11 @@ public class SchAttrCalculator {
115 116 ScheduleRealInfo prve = list.get(0), curr;
116 117 for(int i = 1; i < len; i ++){
117 118 curr = list.get(i);
118   - if(prve.getZdzName().equals(curr.getQdzName()))
  119 + if(prve.getZdzName().equals(curr.getQdzName())){
119 120 curr.setQdzArrDateJH(prve.getZdsj());
  121 + if(StringUtils.isNotEmpty(prve.getZdsjActual()) && StringUtils.isEmpty(curr.getQdzArrDatesj()))
  122 + curr.setQdzArrDatesj(prve.getZdsjActual());
  123 + }
120 124  
121 125 prve = curr;
122 126 }
... ...
src/main/java/com/bsth/entity/CarDevice.java
1 1 package com.bsth.entity;
2 2  
3   -import com.bsth.entity.sys.SysUser;
  3 +import com.bsth.entity.schedule.BEntity;
  4 +import org.joda.time.DateTime;
4 5  
5 6 import javax.persistence.*;
6 7 import java.util.Date;
... ... @@ -10,7 +11,7 @@ import java.util.Date;
10 11 */
11 12 @Entity
12 13 @Table(name = "bsth_c_car_device")
13   -public class CarDevice {
  14 +public class CarDevice extends BEntity {
14 15  
15 16 /** 主键 */
16 17 @Id
... ... @@ -62,18 +63,26 @@ public class CarDevice {
62 63 @Column(nullable = false)
63 64 private Boolean isCancel = false;
64 65  
65   - /** 创建人 */
66   - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
67   - private SysUser createBy;
68   - /** 修改人 */
69   - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
70   - private SysUser updateBy;
71   - /** 创建日期 */
72   - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
73   - private Date createDate;
74   - /** 修改日期 */
75   - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
76   - private Date updateDate;
  66 + public CarDevice() {}
  67 + public CarDevice(Object id, Object xlid, Object clid, Object qyrq) {
  68 + if (id != null) {
  69 + this.id = Long.valueOf(id.toString());
  70 + }
  71 + if (xlid != null) {
  72 + this.xl = Integer.valueOf(xlid.toString());
  73 + }
  74 + if (clid != null) {
  75 + this.cl = Integer.valueOf(clid.toString());
  76 + }
  77 + if (qyrq != null) {
  78 + try {
  79 + this.qyrq = new Date();
  80 + this.qyrq.setTime(Long.parseLong(qyrq.toString()));
  81 + } catch (Exception exp) {
  82 + this.qyrq = new DateTime(qyrq.toString()).toDate();
  83 + }
  84 + }
  85 + }
77 86  
78 87 public Long getId() {
79 88 return id;
... ... @@ -179,38 +188,6 @@ public class CarDevice {
179 188 this.guaranteeDesc = guaranteeDesc;
180 189 }
181 190  
182   - public SysUser getCreateBy() {
183   - return createBy;
184   - }
185   -
186   - public void setCreateBy(SysUser createBy) {
187   - this.createBy = createBy;
188   - }
189   -
190   - public SysUser getUpdateBy() {
191   - return updateBy;
192   - }
193   -
194   - public void setUpdateBy(SysUser updateBy) {
195   - this.updateBy = updateBy;
196   - }
197   -
198   - public Date getCreateDate() {
199   - return createDate;
200   - }
201   -
202   - public void setCreateDate(Date createDate) {
203   - this.createDate = createDate;
204   - }
205   -
206   - public Date getUpdateDate() {
207   - return updateDate;
208   - }
209   -
210   - public void setUpdateDate(Date updateDate) {
211   - this.updateDate = updateDate;
212   - }
213   -
214 191 public Date getQyrq() {
215 192 return qyrq;
216 193 }
... ...
src/main/java/com/bsth/entity/Cars.java
1 1 package com.bsth.entity;
2 2  
3   -import com.bsth.entity.sys.SysUser;
  3 +import com.bsth.entity.schedule.BEntity;
4 4 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
5 5  
6 6 import javax.persistence.*;
... ... @@ -24,7 +24,7 @@ import java.util.Date;
24 24 @Entity
25 25 @Table(name = "bsth_c_cars")
26 26 @JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
27   -public class Cars implements Serializable {
  27 +public class Cars extends BEntity implements Serializable {
28 28  
29 29 /** 主键Id */
30 30 @Id
... ... @@ -136,23 +136,6 @@ public class Cars implements Serializable {
136 136 /** 线路名称(TODO:在原系统里没有,这里暂时留着,并且不做线路关联,只保留个名字) */
137 137 private String xlmc;
138 138  
139   -
140   - /** 创建人 */
141   - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
142   - private SysUser createBy;
143   -
144   - /** 修改人 */
145   - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
146   - private SysUser updateBy;
147   -
148   - /** 创建日期 */
149   - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
150   - private Date createDate;
151   -
152   - /** 修改日期 */
153   - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
154   - private Date updateDate;
155   -
156 139 public Cars() {}
157 140  
158 141 public Cars(Object id, Object nbbh, Object clbh, Object cph, Object sbbh) {
... ... @@ -516,36 +499,4 @@ public class Cars implements Serializable {
516 499 public void setXlmc(String xlmc) {
517 500 this.xlmc = xlmc;
518 501 }
519   -
520   - public SysUser getCreateBy() {
521   - return createBy;
522   - }
523   -
524   - public void setCreateBy(SysUser createBy) {
525   - this.createBy = createBy;
526   - }
527   -
528   - public SysUser getUpdateBy() {
529   - return updateBy;
530   - }
531   -
532   - public void setUpdateBy(SysUser updateBy) {
533   - this.updateBy = updateBy;
534   - }
535   -
536   - public Date getCreateDate() {
537   - return createDate;
538   - }
539   -
540   - public void setCreateDate(Date createDate) {
541   - this.createDate = createDate;
542   - }
543   -
544   - public Date getUpdateDate() {
545   - return updateDate;
546   - }
547   -
548   - public void setUpdateDate(Date updateDate) {
549   - this.updateDate = updateDate;
550   - }
551 502 }
... ...
src/main/java/com/bsth/entity/Personnel.java
1 1 package com.bsth.entity;
2 2  
3   -import com.bsth.entity.sys.SysUser;
  3 +import com.bsth.entity.schedule.BEntity;
4 4 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
5 5  
6 6 import javax.persistence.*;
7   -import java.util.Date;
8 7  
9 8 /**
10 9 *
... ... @@ -23,7 +22,7 @@ import java.util.Date;
23 22 @Entity
24 23 @Table(name = "bsth_c_personnel")
25 24 @JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
26   -public class Personnel {
  25 +public class Personnel extends BEntity {
27 26  
28 27 /** 主键Id */
29 28 @Id
... ... @@ -59,6 +58,20 @@ public class Personnel {
59 58 /** 身份证 */
60 59 private String card;
61 60  
  61 + public Personnel() {}
  62 +
  63 + public Personnel(Object id, Object companyCode, Object gh) {
  64 + if (id != null) {
  65 + this.id = Integer.valueOf(id.toString());
  66 + }
  67 + if (companyCode != null) {
  68 + this.companyCode = companyCode.toString();
  69 + }
  70 + if (gh != null) {
  71 + this.jobCode = gh.toString();
  72 + }
  73 + }
  74 +
62 75 public String getCard() {
63 76 return card;
64 77 }
... ... @@ -78,23 +91,6 @@ public class Personnel {
78 91 /** 描述(TODO:在原系统里没有,这里暂时留着) */
79 92 private String descriptions;
80 93  
81   -
82   -
83   - /** 创建人 */
84   - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
85   - private SysUser createBy;
86   - /** 修改人 */
87   - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
88   - private SysUser updateBy;
89   -
90   - /** 创建日期 */
91   - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
92   - private Date createDate;
93   -
94   - /** 修改日期 */
95   - @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
96   - private Date updateDate;
97   -
98 94 public Integer getId() {
99 95 return id;
100 96 }
... ... @@ -222,36 +218,4 @@ public class Personnel {
222 218 public void setDescriptions(String descriptions) {
223 219 this.descriptions = descriptions;
224 220 }
225   -
226   - public SysUser getCreateBy() {
227   - return createBy;
228   - }
229   -
230   - public void setCreateBy(SysUser createBy) {
231   - this.createBy = createBy;
232   - }
233   -
234   - public SysUser getUpdateBy() {
235   - return updateBy;
236   - }
237   -
238   - public void setUpdateBy(SysUser updateBy) {
239   - this.updateBy = updateBy;
240   - }
241   -
242   - public Date getCreateDate() {
243   - return createDate;
244   - }
245   -
246   - public void setCreateDate(Date createDate) {
247   - this.createDate = createDate;
248   - }
249   -
250   - public Date getUpdateDate() {
251   - return updateDate;
252   - }
253   -
254   - public void setUpdateDate(Date updateDate) {
255   - this.updateDate = updateDate;
256   - }
257 221 }
... ...
src/main/java/com/bsth/entity/mcy_forms/Operationservice.java
... ... @@ -13,6 +13,26 @@ public class Operationservice {
13 13 private String emptMileage;//空驶里程
14 14  
15 15 private String sjbc;//实际班次
  16 +
  17 + private String jname;
  18 +
  19 + private String clzbh;
  20 +
  21 + public String getJname() {
  22 + return jname;
  23 + }
  24 +
  25 + public void setJname(String jname) {
  26 + this.jname = jname;
  27 + }
  28 +
  29 + public String getClzbh() {
  30 + return clzbh;
  31 + }
  32 +
  33 + public void setClzbh(String clzbh) {
  34 + this.clzbh = clzbh;
  35 + }
16 36  
17 37 public String getXlName() {
18 38 return xlName;
... ...
src/main/java/com/bsth/entity/mcy_forms/Shifday.java
... ... @@ -34,7 +34,36 @@ public class Shifday {
34 34  
35 35 private String sjbc;//实际班次
36 36  
  37 + private String jgh;
37 38  
  39 + private String zbh;
  40 +
  41 + private String rq;
  42 +
  43 + public String getRq() {
  44 + return rq;
  45 + }
  46 +
  47 + public void setRq(String rq) {
  48 + this.rq = rq;
  49 + }
  50 +
  51 + public String getJgh() {
  52 + return jgh;
  53 + }
  54 +
  55 + public void setJgh(String jgh) {
  56 + this.jgh = jgh;
  57 + }
  58 +
  59 + public String getZbh() {
  60 + return zbh;
  61 + }
  62 +
  63 + public void setZbh(String zbh) {
  64 + this.zbh = zbh;
  65 + }
  66 +
38 67 public String getJhlc() {
39 68 return jhlc;
40 69 }
... ...
src/main/java/com/bsth/entity/mcy_forms/Shiftuehiclemanth.java
... ... @@ -20,7 +20,24 @@ public class Shiftuehiclemanth {
20 20  
21 21 private String sjbc;//实际班次
22 22  
23   -
  23 + private String jgh;
  24 + private String zbh;
  25 + public String getJgh() {
  26 + return jgh;
  27 + }
  28 +
  29 + public void setJgh(String jgh) {
  30 + this.jgh = jgh;
  31 + }
  32 +
  33 + public String getZbh() {
  34 + return zbh;
  35 + }
  36 +
  37 + public void setZbh(String zbh) {
  38 + this.zbh = zbh;
  39 + }
  40 +
24 41 public String getCjbc() {
25 42 return cjbc;
26 43 }
... ...
src/main/java/com/bsth/entity/mcy_forms/Vehicleloading.java
... ... @@ -24,6 +24,26 @@ public class Vehicleloading {
24 24  
25 25 private String sjbc;//实际班次
26 26  
  27 + private String jgh;//驾驶员工号
  28 +
  29 + private String zbh;//车辆自编号
  30 +
  31 + public String getJgh() {
  32 + return jgh;
  33 + }
  34 +
  35 + public void setJgh(String jgh) {
  36 + this.jgh = jgh;
  37 + }
  38 +
  39 + public String getZbh() {
  40 + return zbh;
  41 + }
  42 +
  43 + public void setZbh(String zbh) {
  44 + this.zbh = zbh;
  45 + }
  46 +
27 47 public String getLs() {
28 48 return ls;
29 49 }
... ...
src/main/java/com/bsth/entity/mcy_forms/Waybillday.java
... ... @@ -20,9 +20,29 @@ public class Waybillday {
20 20  
21 21 private String zlc;//里程
22 22  
  23 + public String getJgh() {
  24 + return jgh;
  25 + }
  26 +
  27 + public void setJgh(String jgh) {
  28 + this.jgh = jgh;
  29 + }
  30 +
  31 + public String getRq() {
  32 + return rq;
  33 + }
  34 +
  35 + public void setRq(String rq) {
  36 + this.rq = rq;
  37 + }
  38 +
23 39 private String yl;//用油
24 40  
25 41 private String nbbm;//机油
  42 +
  43 + private String jgh;//员工号
  44 +
  45 + private String rq;//日期
26 46  
27 47 public String getCarPlate() {
28 48 return carPlate;
... ...
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
... ... @@ -163,7 +163,7 @@ public class ScheduleRealInfo {
163 163 private String qdzArrDatesj;
164 164  
165 165 /** 子任务 */
166   - @OneToMany(fetch = FetchType.LAZY/*, cascade = CascadeType.ALL*/)
  166 + @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
167 167 private Set<ChildTaskPlan> cTasks = new HashSet<>();
168 168  
169 169 /** 关联的公司名称 */
... ...
src/main/java/com/bsth/entity/schedule/BEntity.java 0 → 100644
  1 +package com.bsth.entity.schedule;
  2 +
  3 +import com.bsth.entity.sys.SysUser;
  4 +
  5 +import javax.persistence.*;
  6 +import java.util.Date;
  7 +
  8 +/**
  9 + * Created by xu on 16/12/14.
  10 + */
  11 +@MappedSuperclass
  12 +public class BEntity {
  13 +
  14 + /** 创建人 */
  15 + @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
  16 + private SysUser createBy;
  17 + /** 修改人 */
  18 + @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
  19 + private SysUser updateBy;
  20 +
  21 + /** 创建日期 */
  22 + @Column(updatable = false, name = "create_date")
  23 + private Date createDate;
  24 + /** 修改日期 */
  25 + @Column(name = "update_date")
  26 + private Date updateDate;
  27 +
  28 + public SysUser getCreateBy() {
  29 + return createBy;
  30 + }
  31 +
  32 + public void setCreateBy(SysUser createBy) {
  33 + this.createBy = createBy;
  34 + }
  35 +
  36 + public SysUser getUpdateBy() {
  37 + return updateBy;
  38 + }
  39 +
  40 + public void setUpdateBy(SysUser updateBy) {
  41 + this.updateBy = updateBy;
  42 + }
  43 +
  44 + public Date getCreateDate() {
  45 + return createDate;
  46 + }
  47 +
  48 + public void setCreateDate(Date createDate) {
  49 + this.createDate = createDate;
  50 + }
  51 +
  52 + public Date getUpdateDate() {
  53 + return updateDate;
  54 + }
  55 +
  56 + public void setUpdateDate(Date updateDate) {
  57 + this.updateDate = updateDate;
  58 + }
  59 +}
... ...
src/main/java/com/bsth/entity/schedule/CarConfigInfo.java
... ... @@ -2,7 +2,6 @@ package com.bsth.entity.schedule;
2 2  
3 3 import com.bsth.entity.Cars;
4 4 import com.bsth.entity.Line;
5   -import com.bsth.entity.sys.SysUser;
6 5 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
7 6  
8 7 import javax.persistence.*;
... ... @@ -21,7 +20,7 @@ import java.util.Date;
21 20 })
22 21 })
23 22 @JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
24   -public class CarConfigInfo implements Serializable {
  23 +public class CarConfigInfo extends BEntity implements Serializable {
25 24  
26 25 /** 主健Id */
27 26 @Id
... ... @@ -59,20 +58,6 @@ public class CarConfigInfo implements Serializable {
59 58 @Column(nullable = false)
60 59 private Boolean isCancel = false;
61 60  
62   - /** 创建人 */
63   - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
64   - private SysUser createBy;
65   - /** 修改人 */
66   - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
67   - private SysUser updateBy;
68   -
69   - /** 创建日期 */
70   - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
71   - private Date createDate;
72   - /** 修改日期 */
73   - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
74   - private Date updateDate;
75   -
76 61 public CarConfigInfo() {}
77 62 public CarConfigInfo(Object id, Object xlid, Object xlname, Object clid) {
78 63 if (id != null) {
... ... @@ -164,38 +149,6 @@ public class CarConfigInfo implements Serializable {
164 149 this.isSwitch = isSwitch;
165 150 }
166 151  
167   - public SysUser getCreateBy() {
168   - return createBy;
169   - }
170   -
171   - public void setCreateBy(SysUser createBy) {
172   - this.createBy = createBy;
173   - }
174   -
175   - public SysUser getUpdateBy() {
176   - return updateBy;
177   - }
178   -
179   - public void setUpdateBy(SysUser updateBy) {
180   - this.updateBy = updateBy;
181   - }
182   -
183   - public Date getCreateDate() {
184   - return createDate;
185   - }
186   -
187   - public void setCreateDate(Date createDate) {
188   - this.createDate = createDate;
189   - }
190   -
191   - public Date getUpdateDate() {
192   - return updateDate;
193   - }
194   -
195   - public void setUpdateDate(Date updateDate) {
196   - this.updateDate = updateDate;
197   - }
198   -
199 152 public Boolean getIsCancel() {
200 153 return isCancel;
201 154 }
... ...
src/main/java/com/bsth/entity/schedule/EmployeeConfigInfo.java
... ... @@ -3,13 +3,12 @@ package com.bsth.entity.schedule;
3 3 import com.bsth.entity.Cars;
4 4 import com.bsth.entity.Line;
5 5 import com.bsth.entity.Personnel;
6   -import com.bsth.entity.sys.SysUser;
7 6 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
8 7 import org.hibernate.annotations.Formula;
9 8  
10 9 import javax.persistence.*;
11 10 import javax.validation.constraints.NotNull;
12   -import java.util.Date;
  11 +import java.io.Serializable;
13 12  
14 13 /**
15 14 * 人员配置信息。
... ... @@ -24,7 +23,7 @@ import java.util.Date;
24 23 })
25 24 })
26 25 @JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
27   -public class EmployeeConfigInfo {
  26 +public class EmployeeConfigInfo extends BEntity implements Serializable {
28 27  
29 28 /** 主键Id */
30 29 @Id
... ... @@ -55,20 +54,6 @@ public class EmployeeConfigInfo {
55 54 @Column(nullable = false)
56 55 private Boolean isCancel = false;
57 56  
58   - /** 创建人 */
59   - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
60   - private SysUser createBy;
61   - /** 修改人 */
62   - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
63   - private SysUser updateBy;
64   -
65   - /** 创建日期 */
66   - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
67   - private Date createDate;
68   - /** 修改日期 */
69   - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
70   - private Date updateDate;
71   -
72 57 public EmployeeConfigInfo() {}
73 58  
74 59 public EmployeeConfigInfo(Object id, Object xlid, Object xlname, Object jsyid, Object spyid) {
... ... @@ -156,36 +141,4 @@ public class EmployeeConfigInfo {
156 141 public void setIsCancel(Boolean isCancel) {
157 142 this.isCancel = isCancel;
158 143 }
159   -
160   - public SysUser getCreateBy() {
161   - return createBy;
162   - }
163   -
164   - public void setCreateBy(SysUser createBy) {
165   - this.createBy = createBy;
166   - }
167   -
168   - public SysUser getUpdateBy() {
169   - return updateBy;
170   - }
171   -
172   - public void setUpdateBy(SysUser updateBy) {
173   - this.updateBy = updateBy;
174   - }
175   -
176   - public Date getCreateDate() {
177   - return createDate;
178   - }
179   -
180   - public void setCreateDate(Date createDate) {
181   - this.createDate = createDate;
182   - }
183   -
184   - public Date getUpdateDate() {
185   - return updateDate;
186   - }
187   -
188   - public void setUpdateDate(Date updateDate) {
189   - this.updateDate = updateDate;
190   - }
191 144 }
... ...
src/main/java/com/bsth/entity/schedule/GuideboardInfo.java
1 1 package com.bsth.entity.schedule;
2 2  
3 3 import com.bsth.entity.Line;
4   -import com.bsth.entity.sys.SysUser;
5 4 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
6 5  
7 6 import javax.persistence.*;
8   -import java.util.Date;
9 7  
10 8 /**
11 9 * 路牌信息。
... ... @@ -18,7 +16,7 @@ import java.util.Date;
18 16 })
19 17 })
20 18 @JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
21   -public class GuideboardInfo {
  19 +public class GuideboardInfo extends BEntity {
22 20  
23 21 /** 主键Id */
24 22 @Id
... ... @@ -43,21 +41,6 @@ public class GuideboardInfo {
43 41 @Column(nullable = false)
44 42 private Boolean isCancel = false;
45 43  
46   - /** 创建人 */
47   - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
48   - private SysUser createBy;
49   - /** 修改人 */
50   - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
51   - private SysUser updateBy;
52   -
53   - /** 创建日期 */
54   - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
55   - private Date createDate;
56   - /** 修改日期 */
57   - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
58   - private Date updateDate;
59   -
60   -
61 44 public GuideboardInfo() {}
62 45  
63 46 public GuideboardInfo(Object id, Object xlid, Object lpNo, Object lpName) {
... ... @@ -126,38 +109,6 @@ public class GuideboardInfo {
126 109 this.lpType = lpType;
127 110 }
128 111  
129   - public SysUser getCreateBy() {
130   - return createBy;
131   - }
132   -
133   - public void setCreateBy(SysUser createBy) {
134   - this.createBy = createBy;
135   - }
136   -
137   - public SysUser getUpdateBy() {
138   - return updateBy;
139   - }
140   -
141   - public void setUpdateBy(SysUser updateBy) {
142   - this.updateBy = updateBy;
143   - }
144   -
145   - public Date getCreateDate() {
146   - return createDate;
147   - }
148   -
149   - public void setCreateDate(Date createDate) {
150   - this.createDate = createDate;
151   - }
152   -
153   - public Date getUpdateDate() {
154   - return updateDate;
155   - }
156   -
157   - public void setUpdateDate(Date updateDate) {
158   - this.updateDate = updateDate;
159   - }
160   -
161 112 public Boolean getIsCancel() {
162 113 return isCancel;
163 114 }
... ...
src/main/java/com/bsth/entity/sys/SysUser.java
1 1 package com.bsth.entity.sys;
2 2  
  3 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  4 +
  5 +import javax.persistence.*;
3 6 import java.util.Date;
4 7 import java.util.LinkedHashSet;
5 8 import java.util.Set;
6 9  
7   -import javax.persistence.Column;
8   -import javax.persistence.Entity;
9   -import javax.persistence.FetchType;
10   -import javax.persistence.GeneratedValue;
11   -import javax.persistence.GenerationType;
12   -import javax.persistence.Id;
13   -import javax.persistence.ManyToMany;
14   -import javax.persistence.Table;
15   -
16 10 @Entity
17 11 @Table(name = "bsth_c_sys_user")
  12 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
18 13 public class SysUser {
19 14  
20 15 @Id
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
1 1 package com.bsth.repository.realcontrol;
2 2  
3   -import java.util.List;
4   -import java.util.Map;
5   -
6   -import javax.transaction.Transactional;
7   -
  3 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  4 +import com.bsth.repository.BaseRepository;
8 5 import org.springframework.data.jpa.repository.EntityGraph;
9 6 import org.springframework.data.jpa.repository.Modifying;
10 7 import org.springframework.data.jpa.repository.Query;
11 8 import org.springframework.stereotype.Repository;
12 9  
13   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
14   -import com.bsth.repository.BaseRepository;
  10 +import javax.transaction.Transactional;
  11 +import java.util.List;
  12 +import java.util.Map;
15 13  
16 14 @Repository
17 15 public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealInfo, Long>{
... ... @@ -115,12 +113,13 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
115 113 @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 ORDER BY xlBm,lpName,clZbh,xlDir")
116 114 List<ScheduleRealInfo> setLD(String date);
117 115  
118   - @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 GROUP BY xlBm,lpName,clZbh ORDER BY xlBm,lpName,clZbh")
119   - List<ScheduleRealInfo> setLDGroup(String date);
  116 + @Query(value="select new map(xlBm as xlBm,lpName as lpName,clZbh as clZbh) from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 GROUP BY xlBm,lpName,clZbh ORDER BY xlBm,lpName,clZbh")
  117 + List<Map<String,Object>> setLDGroup(String date);
120 118  
121   - @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 GROUP BY xlBm,clZbh ORDER BY xlBm,clZbh")
122   - List<ScheduleRealInfo> setLCYHGroup(String date);
  119 + @Query(value="select new map(xlBm as xlBm,clZbh as clZbh) from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 GROUP BY xlBm,clZbh ORDER BY xlBm,clZbh")
  120 + List<Map<String,Object>> setLCYHGroup(String date);
123 121  
124   - @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 GROUP BY xlBm ORDER BY xlBm")
125   - List<ScheduleRealInfo> setDDRBGroup(String date);
  122 + @Query(value="select new map(xlBm as xlBm) from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 GROUP BY xlBm ORDER BY xlBm")
  123 + List<Map<String,Object>> setDDRBGroup(String date);
  124 +
126 125 }
... ...
src/main/java/com/bsth/service/forms/CommonService.java 0 → 100644
  1 +package com.bsth.service.forms;
  2 +
  3 +import java.util.Map;
  4 +
  5 +import org.springframework.stereotype.Service;
  6 +
  7 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  8 +import com.bsth.service.BaseService;
  9 +
  10 +@Service
  11 +public interface CommonService{
  12 +
  13 + Map<String,Object> findKMBC1(String jName,String clZbh, String date,String enddate);
  14 +
  15 + Map<String,Object> findKMBC2(String jName,String clZbh,String date);
  16 +}
... ...
src/main/java/com/bsth/service/forms/impl/CommonServiceImpl.java 0 → 100644
  1 +package com.bsth.service.forms.impl;
  2 +
  3 +import java.text.DecimalFormat;
  4 +import java.util.HashMap;
  5 +import java.util.Iterator;
  6 +import java.util.List;
  7 +import java.util.Map;
  8 +import java.util.Set;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.stereotype.Service;
  11 +import com.bsth.entity.realcontrol.ChildTaskPlan;
  12 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  13 +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  14 +import com.bsth.service.forms.CommonService;
  15 +
  16 +@Service
  17 +public class CommonServiceImpl implements CommonService{
  18 +
  19 +
  20 + @Autowired
  21 + ScheduleRealInfoRepository scheduleRealInfoRepository;
  22 +
  23 + @Override
  24 + public Map<String, Object> findKMBC1(String jName, String clZbh,
  25 + String date, String enddate) {
  26 +
  27 + String sql=" select s from bsth_c_s_sp_info_real s "
  28 + + " where s.j_gh ='" + jName + "' and s.cl_zbh ='" + clZbh + "' and "
  29 + + " to_days(s.schedule_date) BETWEEN to_days('" + date + "') and to_days('" + enddate + "')"
  30 + + " order by bcs";
  31 +
  32 +
  33 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill4(jName, clZbh, date, enddate);
  34 + DecimalFormat format = new DecimalFormat("0.00");
  35 +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
  36 +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
  37 + int jhbc = 0,cjbc = 0,ljbc = 0;
  38 + double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0;
  39 + float addMileage = 0l,remMileage = 0l;
  40 + Map<String,Object> map = new HashMap<String, Object>();
  41 + for(ScheduleRealInfo scheduleRealInfo : list){
  42 + if(scheduleRealInfo != null){
  43 + //计划里程(主任务过滤掉临加班次),
  44 + //烂班里程(主任务烂班),
  45 + //临加里程(主任务临加),
  46 + //计划班次,烂班班次,增加班次
  47 + tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
  48 + if(scheduleRealInfo.isSflj()){
  49 + addMileage += tempJhlc;
  50 + ljbc++;
  51 + }else{
  52 + jhlc += tempJhlc;
  53 + jhbc++;
  54 + if(scheduleRealInfo.getStatus() == -1){
  55 + remMileage += tempJhlc;
  56 + cjbc++;
  57 + }
  58 + }
  59 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  60 + //计算营运里程,空驶里程
  61 + if(childTaskPlans.isEmpty()){
  62 + if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
  63 + || scheduleRealInfo.getBcType().equals("venting")){
  64 + ksgl += tempJhlc;
  65 + }else{
  66 + yygl += tempJhlc;
  67 + }
  68 + }else{
  69 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  70 + while(it.hasNext()){
  71 + ChildTaskPlan childTaskPlan = it.next();
  72 + if(childTaskPlan.getMileageType().equals("empty")){
  73 + ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  74 + }else{
  75 + yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  76 + }
  77 + }
  78 + }
  79 + }
  80 + }
  81 + map.put("jhlc", format.format(jhlc));
  82 + map.put("remMileage", format.format(remMileage));
  83 + map.put("addMileage", format.format(addMileage));
  84 + map.put("yygl", format.format(yygl));
  85 + map.put("ksgl", format.format(ksgl));
  86 + map.put("realMileage", format.format(yygl+ksgl));
  87 + map.put("jhbc", jhbc);
  88 + map.put("cjbc", cjbc);
  89 + map.put("ljbc", ljbc);
  90 + map.put("sjbc", jhbc-cjbc+ljbc);
  91 + return map;
  92 + }
  93 +
  94 +
  95 + @Override
  96 + public Map<String, Object> findKMBC2(String jName, String clZbh,String date) {
  97 +
  98 + String sql=" select s from bsth_c_s_sp_info_real s "
  99 + + " where s.j_gh ='" + jName + "' and s.cl_zbh ='" + clZbh + "' and "
  100 + + " to_days(s.schedule_date) =to_days('" + date + "')"
  101 + + " order by bcs";
  102 +
  103 +
  104 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh , date);
  105 +
  106 + DecimalFormat format = new DecimalFormat("0.00");
  107 +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
  108 +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
  109 + int jhbc = 0,cjbc = 0,ljbc = 0;
  110 + double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0;
  111 + float addMileage = 0l,remMileage = 0l;
  112 + String j_Name="";
  113 + Map<String,Object> map = new HashMap<String, Object>();
  114 + for(ScheduleRealInfo scheduleRealInfo : list){
  115 + if(scheduleRealInfo != null){
  116 + j_Name=scheduleRealInfo.getjName();
  117 + //计划里程(主任务过滤掉临加班次),
  118 + //烂班里程(主任务烂班),
  119 + //临加里程(主任务临加),
  120 + //计划班次,烂班班次,增加班次
  121 + tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
  122 + if(scheduleRealInfo.isSflj()){
  123 + addMileage += tempJhlc;
  124 + ljbc++;
  125 + }else{
  126 + jhlc += tempJhlc;
  127 + jhbc++;
  128 + if(scheduleRealInfo.getStatus() == -1){
  129 + remMileage += tempJhlc;
  130 + cjbc++;
  131 + }
  132 + }
  133 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  134 + //计算营运里程,空驶里程
  135 + if(childTaskPlans.isEmpty()){
  136 + if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
  137 + || scheduleRealInfo.getBcType().equals("venting")){
  138 + ksgl += tempJhlc;
  139 + }else{
  140 + yygl += tempJhlc;
  141 + }
  142 + }else{
  143 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  144 + while(it.hasNext()){
  145 + ChildTaskPlan childTaskPlan = it.next();
  146 + if(childTaskPlan.getMileageType().equals("empty")){
  147 + ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  148 + }else{
  149 + yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  150 + }
  151 + }
  152 + }
  153 + }
  154 + }
  155 + map.put("j_name", j_Name);
  156 + map.put("jhlc", format.format(jhlc));
  157 + map.put("remMileage", format.format(remMileage));
  158 + map.put("addMileage", format.format(addMileage));
  159 + map.put("yygl", format.format(yygl));
  160 + map.put("ksgl", format.format(ksgl));
  161 + map.put("realMileage", format.format(yygl+ksgl));
  162 + map.put("jhbc", jhbc);
  163 + map.put("cjbc", cjbc);
  164 + map.put("ljbc", ljbc);
  165 + map.put("sjbc", jhbc-cjbc+ljbc);
  166 + return map;
  167 + }
  168 +
  169 +
  170 +
  171 +
  172 +}
... ...
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
... ... @@ -64,16 +64,22 @@ public class FormsServiceImpl implements FormsService {
64 64 // System.out.println(arg0.getObject("yl"));
65 65 // wbd.setYl(arg0.getString("yl"));
66 66 // wbd.setNbbm(arg0.getString("nbbm"));
67   - Map<String, Object> maps = new HashMap<>();
68   - maps = scheduleRealInfoService.findKMBC2(arg0.getString("j_gh"), arg0.getString("cl_zbh"),
69   - arg0.getString("schedule_date"));
70   - wbd.setJzl1(maps.get("ksgl").toString());
71   - wbd.setZlc(maps.get("realMileage").toString());
72   -
  67 + wbd.setRq(arg0.getString("schedule_date"));
  68 + wbd.setJgh(arg0.getString("j_gh"));
73 69 return wbd;
74 70  
75 71 }
76 72 });
  73 +
  74 + for(int i=0;i<list.size();i++){
  75 + Waybillday w=list.get(i);
  76 + Map<String, Object> maps = new HashMap<>();
  77 + maps = scheduleRealInfoService.findKMBC2(w.getJgh(), w.getCarPlate(),
  78 + w.getRq());
  79 + w.setJzl1(maps.get("ksgl").toString());
  80 + w.setZlc(maps.get("realMileage").toString());
  81 +
  82 + }
77 83 return list;
78 84 }
79 85  
... ... @@ -102,6 +108,9 @@ public class FormsServiceImpl implements FormsService {
102 108 return lin;
103 109 }
104 110 });
  111 +
  112 +
  113 +
105 114 return list;
106 115 }
107 116  
... ... @@ -111,12 +120,13 @@ public class FormsServiceImpl implements FormsService {
111 120  
112 121 @Override
113 122 public List<Shiftuehiclemanth> shiftuehiclemanth(Map<String, Object> map) {
114   - String sql = "select r.j_name,r.cl_zbh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "
  123 + String sql = "select r.j_name,r.cl_zbh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name,r.bc_type "
115 124 + " from bsth_c_s_sp_info_real r "
116 125 + " where to_days(r.schedule_date_str) BETWEEN to_days('" + map.get("startDate").toString() + "') "
117 126 + " and to_days('" + map.get("endDate").toString() + "') "
118 127 + " and r.xl_bm='"+ map.get("line").toString() + "'"
119 128 + " AND r.gs_bm is not null"
  129 + + " and r.bc_type not in('in','out')"
120 130 /* + " and r.gs_bm='"+map.get("gsdmManth").toString()+"'"
121 131 + " and r.fgs_bm='"+map.get("fgsdmManth").toString()+"'"*/
122 132 + " GROUP BY r.j_name,r.cl_zbh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name"
... ... @@ -130,26 +140,29 @@ public class FormsServiceImpl implements FormsService {
130 140 public Shiftuehiclemanth mapRow(ResultSet arg0, int arg1) throws SQLException {
131 141 Shiftuehiclemanth shif = new Shiftuehiclemanth();
132 142 shif.setjName(arg0.getString("j_name"));
133   -
134   - Map<String, Object> maps = new HashMap<>();
135   -
136   - maps = scheduleRealInfoService.findKMBC1(arg0.getString("j_name"), arg0.getString("cl_zbh"), startDate,
137   - endDate);
138   -
139   - shif.setJhlc(maps.get("jhlc").toString());
140   - shif.setEmptMileage(maps.get("ksgl").toString());
141   - shif.setRemMileage(maps.get("remMileage").toString());
142   - shif.setAddMileage(maps.get("addMileage").toString());
143   - shif.setTotalm(maps.get("realMileage").toString());
144   - shif.setCjbc(maps.get("cjbc").toString());
145   - shif.setLjbc(maps.get("ljbc").toString());
146   - shif.setSjbc(maps.get("sjbc").toString());
147   -
  143 + shif.setJgh(arg0.getString("j_gh"));
  144 + shif.setZbh(arg0.getString("cl_zbh"));
148 145 return shif;
149   -
150 146 }
151 147 });
  148 +
  149 + for(int i=0;i<list.size();i++){
  150 + Shiftuehiclemanth s=list.get(i);
  151 + Map<String, Object> maps = new HashMap<>();
  152 +
  153 + maps = scheduleRealInfoService.findKMBC1(s.getjName(),s.getZbh(), startDate,
  154 + endDate);
  155 +
  156 + s.setJhlc(maps.get("jhlc").toString());
  157 + s.setEmptMileage(maps.get("ksgl").toString());
  158 + s.setRemMileage(maps.get("remMileage").toString());
  159 + s.setAddMileage(maps.get("addMileage").toString());
  160 + s.setTotalm(maps.get("realMileage").toString());
  161 + s.setCjbc(maps.get("cjbc").toString());
  162 + s.setLjbc(maps.get("ljbc").toString());
  163 + s.setSjbc(maps.get("sjbc").toString());
152 164  
  165 + }
153 166 return list;
154 167 }
155 168  
... ... @@ -157,10 +170,11 @@ public class FormsServiceImpl implements FormsService {
157 170 @Override
158 171 public List<Shifday> shifday(Map<String, Object> map) {
159 172 String sql = " select r.schedule_date,r.lp_name,r.xl_name,r.j_name,r.s_name, r.cl_zbh,r.xl_bm,"
160   - + " r.cl_zbh,r.j_gh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "
  173 + + " r.cl_zbh,r.j_gh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name,r.bc_type "
161 174 + " FROM bsth_c_s_sp_info_real r "
162 175 + " where to_days(r.schedule_date)=to_days('"
163 176 + map.get("date").toString() + "') and r.xl_bm=" + map.get("line").toString()
  177 + + " and r.bc_type not in('in','out')"
164 178 /*+ " and r.gs_bm='"+map.get("gsdmShif").toString()+"'"
165 179 + " and r.fgs_bm='"+map.get("fgsdmShif").toString()+"'"*/
166 180 + " GROUP BY r.schedule_date,r.lp_name,r.xl_name,r.j_name,r.s_name, r.cl_zbh,r.xl_bm,r.cl_zbh,r.j_gh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "
... ... @@ -175,25 +189,34 @@ public class FormsServiceImpl implements FormsService {
175 189 shifday.setsName(arg0.getString("s_name") == null ? "" : arg0.getString("s_name").toString());
176 190 shifday.setLpName(arg0.getString("r.lp_name").toString());
177 191 shifday.setCarPlate(arg0.getString("cl_zbh").toString());
178   -
179   - Map<String, Object> map = new HashMap<>();
180   - map = scheduleRealInfoService.findKMBC2(arg0.getString("j_gh"), arg0.getString("cl_zbh"),
181   - arg0.getString("schedule_date"));
182   - shifday.setJhlc(map.get("jhlc").toString());// 计划里程
183   - //shifday.setSjjhlc(map.get("remMileage").toString());//实际计划里程
184   - shifday.setYygl(map.get("yygl").toString());// 营运里程
185   - shifday.setEmptMileage(map.get("ksgl").toString());// 空驶里程
186   - shifday.setRemMileage(map.get("remMileage").toString());// 抽减里程
187   - shifday.setAddMileage(map.get("addMileage").toString());// 增加里程
188   - shifday.setTotalm(map.get("realMileage").toString());// 总里程
189   - shifday.setJhbc(map.get("jhbc").toString());// 计划班次
190   - //shifday.setSjjhbc(map.get("sjjhbc").toString());//实际计划班次
191   - shifday.setCjbc(map.get("cjbc").toString());// 抽减班次
192   - shifday.setLjbc(map.get("ljbc").toString());// 增加班次
193   - shifday.setSjbc(map.get("sjbc").toString());// 实际班次
  192 + shifday.setJgh(arg0.getString("j_gh"));
  193 + shifday.setZbh(arg0.getString("cl_zbh"));
  194 + shifday.setRq(arg0.getString("schedule_date"));
194 195 return shifday;
195 196 }
  197 +
196 198 });
  199 +
  200 + for(int i=0;i<list.size();i++){
  201 + Shifday shi=list.get(i);
  202 + Map<String, Object> maps = new HashMap<>();
  203 + maps = scheduleRealInfoService.findKMBC2(shi.getJgh(), shi.getCarPlate(),
  204 + shi.getRq());
  205 + shi.setJhlc(maps.get("jhlc").toString());// 计划里程
  206 + //shifday.setSjjhlc(map.get("remMileage").toString());//实际计划里程
  207 + shi.setYygl(maps.get("yygl").toString());// 营运里程
  208 + shi.setEmptMileage(maps.get("ksgl").toString());// 空驶里程
  209 + shi.setRemMileage(maps.get("remMileage").toString());// 抽减里程
  210 + shi.setAddMileage(maps.get("addMileage").toString());// 增加里程
  211 + shi.setTotalm(maps.get("realMileage").toString());// 总里程
  212 + shi.setJhbc(maps.get("jhbc").toString());// 计划班次
  213 + //shifday.setSjjhbc(map.get("sjjhbc").toString());//实际计划班次
  214 + shi.setCjbc(maps.get("cjbc").toString());// 抽减班次
  215 + shi.setLjbc(maps.get("ljbc").toString());// 增加班次
  216 + shi.setSjbc(maps.get("sjbc").toString());// 实际班次
  217 +
  218 + }
  219 +
197 220 return list;
198 221 }
199 222  
... ... @@ -240,20 +263,20 @@ public class FormsServiceImpl implements FormsService {
240 263 Changetochange chan = new Changetochange();
241 264  
242 265 chan.setRq(rq);
243   - chan.setGs(arg0.getString("gs").toString());
244   - chan.setFgs(arg0.getString("fgs").toString());
245   - chan.setXl(arg0.getString("xl").toString());
246   - chan.setLp(arg0.getString("lp").toString());
247   - chan.setFssj(arg0.getString("fssj").toString());
248   - chan.setXgsj(arg0.getString("xgsj").toString());
249   - chan.setPcch(arg0.getString("pcch").toString());
250   - chan.setPcry(arg0.getString("pcry").toString());
251   - chan.setJhch(arg0.getString("jhch").toString());
252   - chan.setJhgh(arg0.getString("jhgh").toString());
253   - chan.setSjch(arg0.getString("sjch").toString());
254   - chan.setSjgh(arg0.getString("sjgh").toString());
255   - chan.setYy(arg0.getString("yy").toString());
256   - chan.setXgr(arg0.getString("xgr").toString());
  266 + chan.setGs(arg0.getString("gs"));
  267 + chan.setFgs(arg0.getString("fgs"));
  268 + chan.setXl(arg0.getString("xl"));
  269 + chan.setLp(arg0.getString("lp"));
  270 + chan.setFssj(arg0.getString("fssj"));
  271 + chan.setXgsj(arg0.getString("xgsj"));
  272 + chan.setPcch(arg0.getString("pcch"));
  273 + chan.setPcry(arg0.getString("pcry"));
  274 + chan.setJhch(arg0.getString("jhch"));
  275 + chan.setJhgh(arg0.getString("jhgh"));
  276 + chan.setSjch(arg0.getString("sjch"));
  277 + chan.setSjgh(arg0.getString("sjgh"));
  278 + chan.setYy(arg0.getString("yy"));
  279 + chan.setXgr(arg0.getString("xgr"));
257 280 return chan;
258 281 }
259 282 });
... ... @@ -279,7 +302,7 @@ public class FormsServiceImpl implements FormsService {
279 302  
280 303 rq = rq2 + "-" + rq3;
281 304  
282   - String sql = " SELECT r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "
  305 + String sql = " SELECT r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "
283 306 + " FROM bsth_c_s_sp_info_real r "
284 307 + " INNER join ( select y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH from bsth_c_ylb y "
285 308 + " where y.RQ BETWEEN '" + map.get("startDate").toString() + "' and '"+ map.get("endDate").toString() + "'"
... ... @@ -300,28 +323,32 @@ public class FormsServiceImpl implements FormsService {
300 323 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
301 324 Singledata sin = new Singledata();
302 325 sin.setrQ(rq);
303   - sin.setgS(arg0.getString("gs_name").toString());
304   - sin.setxL(arg0.getString("xl_bm").toString());
305   - sin.setClzbh(arg0.getString("cl_zbh").toString());
306   - sin.setJsy(arg0.getString("j_gh").toString());
307   - sin.setjName(arg0.getString("j_name").toString());
308   - sin.setHyl(arg0.getString("YH").toString());
309   - sin.setJzl(arg0.getString("JZL").toString());
  326 + sin.setgS(arg0.getString("gs_name"));
  327 + sin.setxL(arg0.getString("xl_bm"));
  328 + sin.setClzbh(arg0.getString("cl_zbh"));
  329 + sin.setJsy(arg0.getString("j_gh"));
  330 + sin.setjName(arg0.getString("j_name"));
  331 + sin.setHyl(arg0.getString("YH"));
  332 + sin.setJzl(arg0.getString("JZL"));
310 333 // sin.setJzl(arg0.getString(""));//非营业性用油
311 334 sin.setJhjl(arg0.getString("JZL"));
312   - Map<String, Object> maps = new HashMap<>();
313   - maps = scheduleRealInfoService.findKMBC1(arg0.getString("j_name"), arg0.getString("cl_zbh"), startDate,
314   - endDate);
315   - //sin.setjName(maps.get("j_name") == null ? "" : maps.get("j_name").toString());
316   - sin.setSgh(maps.get("s_gh") == null ? "" : maps.get("s_gh").toString());
317   - sin.setsName(maps.get("s_name") == null ? "" : maps.get("s_name").toString());
318   - sin.setJhlc(maps.get("yygl") == null ? "" : maps.get("yygl").toString());
319   - sin.setEmptMileage(maps.get("ksgl") == null ? "" : maps.get("ksgl").toString());
320   - sin.setJhjl(maps.get("jhlc") == null ? "" : maps.get("jhlc").toString());
321   -
  335 +
322 336 return sin;
323 337 }
324 338 });
  339 + for(int i=0;i<list.size();i++){
  340 + Singledata si=list.get(i);
  341 + Map<String, Object> maps = new HashMap<>();
  342 + maps = scheduleRealInfoService.findKMBC1(si.getjName(),si.getClzbh(), startDate,
  343 + endDate);
  344 + //sin.setjName(maps.get("j_name") == null ? "" : maps.get("j_name").toString());
  345 + si.setSgh(maps.get("s_gh") == null ? "" : maps.get("s_gh").toString());
  346 + si.setsName(maps.get("s_name") == null ? "" : maps.get("s_name").toString());
  347 + si.setJhlc(maps.get("yygl") == null ? "" : maps.get("yygl").toString());
  348 + si.setEmptMileage(maps.get("ksgl") == null ? "" : maps.get("ksgl").toString());
  349 + si.setJhjl(maps.get("jhlc") == null ? "" : maps.get("jhlc").toString());
  350 +
  351 + }
325 352 return list;
326 353 }
327 354  
... ... @@ -329,7 +356,7 @@ public class FormsServiceImpl implements FormsService {
329 356 @Override
330 357 public List<Operationservice> operationservice(Map<String, Object> map) {
331 358  
332   - String sql = " SELECT r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "
  359 + String sql = " SELECT r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name,r.bc_type "
333 360 + " FROM bsth_c_s_sp_info_real r "
334 361 // + "LEFT JOIN bsth_c_s_sp_info_real r on r.cl_zbh=y.NBBM"
335 362 + " INNER join ( select y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH from bsth_c_ylb y "
... ... @@ -338,6 +365,7 @@ public class FormsServiceImpl implements FormsService {
338 365 + " where r.schedule_date_str BETWEEN '"+ map.get("startDate").toString()
339 366 + "'" + " and '" + map.get("endDate").toString() + "'"
340 367 + " and r.xl_bm='" + map.get("line").toString() + "'"
  368 + + " and r.bc_type not in('in','out')"
341 369 /* + " and r.gs_bm='"+map.get("gsdmOperat").toString()+"'"
342 370 + " and r.fgs_bm='"+map.get("fgsdmOperat").toString()+"'"*/
343 371 + " AND r.gs_bm is not null"
... ... @@ -351,26 +379,34 @@ public class FormsServiceImpl implements FormsService {
351 379 @Override
352 380 public Operationservice mapRow(ResultSet arg0, int arg1) throws SQLException {
353 381 Operationservice op = new Operationservice();
354   - op.setXlName(arg0.getString("xl_name").toString());
355   - op.setJzl(arg0.getString("JZL").toString());
356   - op.setXhl(arg0.getString("YH").toString());
357   - Map<String, Object> maps = new HashMap<>();
358   - maps = scheduleRealInfoService.findKMBC1(arg0.getString("j_name"), arg0.getString("cl_zbh"), startDate,
359   - endDate);
360   - op.setXsgl(maps.get("yygl").toString() == null ? "" : maps.get("yygl").toString());
361   - op.setEmptMileage(maps.get("ksgl").toString() == null ? "" : maps.get("ksgl").toString());
362   - op.setSjbc(maps.get("sjbc").toString() == null ? "" : maps.get("sjbc").toString());
  382 + op.setXlName(arg0.getString("xl_name"));
  383 + op.setJzl(arg0.getString("JZL"));
  384 + op.setXhl(arg0.getString("YH"));
  385 + op.setClzbh(arg0.getString("cl_zbh"));
  386 + op.setJname(arg0.getString("j_name"));
  387 +
363 388 return op;
364 389 }
365 390 });
  391 +
  392 + for(int i=0;i<list.size();i++){
  393 + Operationservice o=list.get(i);
  394 + Map<String, Object> maps = new HashMap<>();
  395 + maps = scheduleRealInfoService.findKMBC1(o.getJname(), o.getClzbh(), startDate,
  396 + endDate);
  397 + o.setXsgl(maps.get("yygl").toString() == null ? "" : maps.get("yygl").toString());
  398 + o.setEmptMileage(maps.get("ksgl").toString() == null ? "" : maps.get("ksgl").toString());
  399 + o.setSjbc(maps.get("sjbc").toString() == null ? "" : maps.get("sjbc").toString());
  400 + }
366 401 return list;
367 402 }
368 403  
  404 +
369 405 // 车辆加注
370 406 @Override
371 407 public List<Vehicleloading> vehicleloading(/*String gsdmVehic,String fgsdmVehic,*/String line, String date) {
372 408  
373   - String sql = " SELECT r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_name,y.YH,y.JZL,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "
  409 + String sql = " SELECT r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_name,y.YH,y.JZL,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name,r.bc_type "
374 410 + " FROM bsth_c_s_sp_info_real r "
375 411 + " INNER join ( select y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH from bsth_c_ylb y "
376 412 + " where to_days(y.RQ)=to_days('" + date + "') and y.XLBM= '" + line + "' GROUP BY y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH) y "
... ... @@ -378,6 +414,7 @@ public class FormsServiceImpl implements FormsService {
378 414 + " where to_days(r.schedule_date_str)=to_days('" + date + "')"
379 415 + " and r.xl_bm='" + line + "' "
380 416 + " AND r.gs_bm is not null"
  417 + + " and r.bc_type not in('in','out')"
381 418 /* + " and r.gs_bm='"+gsdmVehic +"'"
382 419 + " and r.fgs_bm='"+fgsdmVehic +"'"*/
383 420 + " GROUP BY r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_name,y.YH,y.JZL,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name ";
... ... @@ -388,22 +425,28 @@ public class FormsServiceImpl implements FormsService {
388 425 @Override
389 426 public Vehicleloading mapRow(ResultSet arg0, int arg1) throws SQLException {
390 427 Vehicleloading ve = new Vehicleloading();
391   - ve.setrQ(arg0.getString("schedule_date_str").toString());
392   - ve.setgS(arg0.getString("gs_name").toString());
393   - ve.setxL(arg0.getString("xl_name").toString());
394   - ve.setClzbh(arg0.getString("cl_zbh").toString());
395   - ve.setHyl(arg0.getString("YH").toString());
396   - ve.setJzl(arg0.getString("JZL").toString());
  428 + ve.setrQ(arg0.getString("schedule_date_str"));
  429 + ve.setgS(arg0.getString("gs_name"));
  430 + ve.setxL(arg0.getString("xl_name"));
  431 + ve.setClzbh(arg0.getString("cl_zbh"));
  432 + ve.setHyl(arg0.getString("YH"));
  433 + ve.setJzl(arg0.getString("JZL"));
397 434 // ve.setLs(arg0.getString("").toString());//尿素
398   - Map<String, Object> maps = new HashMap<>();
399   - maps = scheduleRealInfoService.findKMBC2(arg0.getString("j_gh"), arg0.getString("cl_zbh"),
400   - arg0.getString("schedule_date_str"));
401   - ve.setJhlc(maps.get("yygl") == null ? "" : maps.get("yygl").toString());
402   - ve.setJhbc(maps.get("jhbc").toString() == null ? "" : maps.get("jhbc").toString());// 计划班次
403   - ve.setSjbc(maps.get("sjbc").toString() == null ? "" : maps.get("sjbc").toString());// 实际班次
  435 + ve.setJgh(arg0.getString("j_gh").toString());
404 436 return ve;
405 437 }
406 438 });
  439 +
  440 + for(int i=0;i<list.size();i++){
  441 + Vehicleloading v=list.get(i);
  442 + Map<String, Object> maps = new HashMap<>();
  443 + maps = scheduleRealInfoService.findKMBC2(v.getJgh(), line,
  444 + date);
  445 + v.setJhlc(maps.get("yygl") == null ? "" : maps.get("yygl").toString());
  446 + v.setJhbc(maps.get("jhbc").toString() == null ? "" : maps.get("jhbc").toString());// 计划班次
  447 + v.setSjbc(maps.get("sjbc").toString() == null ? "" : maps.get("sjbc").toString());// 实际班次
  448 + }
  449 +
407 450 return list;
408 451 }
409 452  
... ... @@ -427,20 +470,22 @@ public class FormsServiceImpl implements FormsService {
427 470  
428 471 rq = rq2 + "-" + rq3;
429 472  
430   - String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,b.warrant_car from "
431   - + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl"
  473 + String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,b.warrant_car,a.bc_type from "
  474 + + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl,bc_type"
432 475 + " from bsth_c_s_sp_info" + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '"+ map.get("startDate").toString() + "' "
433 476 + " and '" + map.get("endDate").toString() + "' and xl_bm='"+ map.get("line").toString() + "' "
434 477 + " AND gs_bm is not null "
  478 + + " AND bc_type NOT IN ('in', 'out')"
435 479 /*+ " and gs_bm='"+ map.get("gsdmTurn").toString() + "'"
436 480 + " and fgs_bm='"+ map.get("fgsdmTurn").toString() + "'"*/
437   - + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name ) a left JOIN ("
  481 + + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type ) a left JOIN ("
438 482 + " SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl,t.warrant_car "
439   - + " from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl from bsth_c_s_sp_info_real "
  483 + + " from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl,bc_type from bsth_c_s_sp_info_real "
440 484 + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '" + map.get("startDate").toString() + "' and '"
441 485 + map.get("endDate").toString() + "' and xl_bm='" + map.get("line").toString()
442 486 + "' AND gs_bm is not null "
443   - + "GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name) b ON t.company=b.gs_bm) b on "
  487 + + " AND bc_type NOT IN ('in', 'out')"
  488 + + "GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type) b ON t.company=b.gs_bm) b on "
444 489 + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm ";
445 490 List<Turnoutrate> list = jdbcTemplate.query(sql, new RowMapper<Turnoutrate>() {
446 491  
... ... @@ -473,6 +518,7 @@ public class FormsServiceImpl implements FormsService {
473 518  
474 519 });
475 520  
  521 +
476 522 return list;
477 523 }
478 524  
... ... @@ -496,20 +542,20 @@ public class FormsServiceImpl implements FormsService {
496 542  
497 543 rq = rq2 + "-" + rq3;
498 544  
499   - String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm from "
500   - + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl"
  545 + String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,a.bc_type from "
  546 + + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl,bc_type"
501 547 + " from bsth_c_s_sp_info" + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '"
502 548 + map.get("startDate").toString() + "' and '" + map.get("endDate").toString() + "' and xl_bm='"
503   - + map.get("line").toString() + "' AND gs_bm is not null"
  549 + + map.get("line").toString() + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out')"
504 550 /*+ " and gs_bm='"+ map.get("gsdmEcecut").toString() + "'"
505 551 + " and fgs_bm='"+ map.get("fgsdmEcecut").toString() + "'"*/
506   - + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name ) a left JOIN ("
507   - + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl "
508   - + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl from bsth_c_s_sp_info_real "
  552 + + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type ) a left JOIN ("
  553 + + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl "
  554 + + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl,bc_type from bsth_c_s_sp_info_real "
509 555 + "where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '" + map.get("startDate").toString() + "' and '"
510 556 + map.get("endDate").toString() + "' and xl_bm='" + map.get("line").toString()
511   - + "' AND gs_bm is not null "
512   - + "GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name) b ON t.company=b.gs_bm) b on "
  557 + + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out') "
  558 + + "GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type) b ON t.company=b.gs_bm) b on "
513 559 + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm ";
514 560 List<Executionrate> list = jdbcTemplate.query(sql, new RowMapper<Executionrate>() {
515 561  
... ... @@ -563,22 +609,27 @@ public class FormsServiceImpl implements FormsService {
563 609 String rq2 = sdf1.format(d);
564 610 String rq3 = sdf1.format(d1);
565 611  
  612 +
  613 +
566 614 rq = rq2 + "-" + rq3;
567 615  
568   - String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm from "
569   - + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl"
  616 + String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,a.bc_type from "
  617 + + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl,bc_type"
570 618 + " from bsth_c_s_sp_info" + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '"
571 619 + map.get("startDate").toString() + "' and '" + map.get("endDate").toString() + "' and xl_bm='"
572   - + map.get("line").toString() + "' AND gs_bm is not null"
  620 + + map.get("line").toString() + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out') "
573 621 /*+ " and gs_bm='"+ map.get("gsdmAllline").toString() + "'"
574 622 + " and fgs_bm='"+ map.get("fgsdmAllline").toString() + "'"*/
575   - + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name ) a left JOIN ("
576   - + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl "
577   - + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl from bsth_c_s_sp_info_real "
  623 + + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type ) a left JOIN ("
  624 + + "SELECT COUNT(*"
  625 + + ") as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b."
  626 + + "xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl "
  627 + + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl,bc_type from bsth_c_s_sp_info_real "
578 628 + "where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '" + map.get("startDate").toString() + "' and '"
579   - + map.get("endDate").toString() + "' and xl_bm='" + map.get("line").toString()
580   - + "' AND gs_bm is not null "
581   - + "GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name) b ON t.company=b.gs_bm) b on "
  629 + + map.get("endDate").toString() + "' and xl_bm='" + map.get
  630 + ("line").toString()
  631 + + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out')"
  632 + + "GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type) b ON t.company=b.gs_bm) b on "
582 633 + " a.gs_bm=b.gs_bm and a.fgs_bm=b.fgs_bm and a.xl_bm=b.xl_bm ";
583 634 List<Allline> list = jdbcTemplate.query(sql, new RowMapper<Allline>() {
584 635  
... ... @@ -603,14 +654,19 @@ public class FormsServiceImpl implements FormsService {
603 654 tu.setBcjh(arg0.getString("jbc").toString());
604 655 tu.setBcsj(arg0.getString("sbc").toString());
605 656 tu.setBbzxl(result2 + "%");// 班次执行率
  657 +
606 658 // tu.setSm(arg0.getString("xl_name").toString());
607 659 tu.setGsgs(arg0.getString("gslsbm").toString());
608 660 tu.setFgsgs(arg0.getString("fgsbm").toString());
609 661 return tu;
610 662 }
611 663  
  664 +
612 665 });
  666 +
613 667  
  668 +
  669 +
614 670 return list;
615 671 }
616 672 }
... ...
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
... ... @@ -24,7 +24,6 @@ import org.slf4j.LoggerFactory;
24 24 import org.springframework.beans.factory.annotation.Autowired;
25 25 import org.springframework.data.domain.Sort;
26 26 import org.springframework.data.domain.Sort.Direction;
27   -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
28 27 import org.springframework.stereotype.Service;
29 28  
30 29 import java.io.BufferedOutputStream;
... ... @@ -37,6 +36,8 @@ import java.sql.ResultSet;
37 36 import java.text.DecimalFormat;
38 37 import java.text.SimpleDateFormat;
39 38 import java.util.*;
  39 +import java.util.regex.Pattern;
  40 +
40 41 /**
41 42 *
42 43 * @ClassName: TrafficManageServiceImpl(运管处接口service业务层实现类)
... ... @@ -102,9 +103,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{
102 103 @Autowired
103 104 private ScheduleRealInfoRepository scheduleRealInfoRepository;
104 105  
105   - @Autowired
106   - NamedParameterJdbcTemplate jdbcTemplate;
107   -
108 106  
109 107 // 运管处接口
110 108 private InternalPortType portType = new Internal().getInternalHttpSoap11Endpoint();
... ... @@ -299,32 +297,38 @@ public class TrafficManageServiceImpl implements TrafficManageService{
299 297 */
300 298 public String setLD(){
301 299 String result = "failure";
  300 + Line line;
302 301 // 取昨天 的日期
303 302 String date = sdfnyr.format(DateUtils.addDays(new Date(), -1));
304 303 StringBuffer sf = new StringBuffer();
305 304 try {
306 305 sf.append("<DLDS>");
307 306 List<ScheduleRealInfo> list = scheduleRealInfoRepository.setLD(date);
308   - List<ScheduleRealInfo> listGroup = scheduleRealInfoRepository.setLDGroup(date);
  307 + List<Map<String,Object>> listGroup = scheduleRealInfoRepository.setLDGroup(date);
309 308 Map<String,Object> map = new HashMap<String,Object>();
310   - for(ScheduleRealInfo schRealInfo:listGroup){
  309 + for(Map<String,Object> schRealInfo:listGroup){
311 310 if(schRealInfo != null){
312 311 //根据车辆自编号查询车牌号
313   - map.put("insideCode_eq", schRealInfo.getClZbh());
  312 + map.put("insideCode_eq", schRealInfo.get("clZbh")+"");
314 313 Cars car = carsRepository.findOne(new CustomerSpecs<Cars>(map));
  314 + // 获取线路是否使用标识,如果未使用,则不查该线路数据
  315 + line = lineRepository.findByLineCode(schRealInfo.get("xlBm")+"");
  316 + if(line.getInUse() == null || line.getInUse() == 0){
  317 + continue;
  318 + }
315 319 sf.append("<DLD>");
316   - sf.append("<RQ>"+schRealInfo.getScheduleDateStr()+"</RQ>");
317   - sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.getXlBm())+"</XLBM>");
318   - sf.append("<LPBH>"+schRealInfo.getLpName()+"</LPBH>");
  320 + sf.append("<RQ>"+date+"</RQ>");
  321 + sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.get("xlBm")+"")+"</XLBM>");
  322 + sf.append("<LPBH>"+schRealInfo.get("lpName")+"</LPBH>");
319 323 sf.append("<CPH>"+car.getCarPlate()+"</CPH>");
320   - sf.append("<UPDT>"+sdfnyrsfm.format(schRealInfo.getUpdateDate())+"</UPDT>");
  324 + sf.append("<UPDT>"+sdfnyrsfm.format(new Date())+"</UPDT>");
321 325 sf.append("<LDList>");
322 326  
323 327 int seqNumber = 0;
324 328 for(ScheduleRealInfo scheduleRealInfo:list){
325   - if(schRealInfo.getXlBm().equals(scheduleRealInfo.getXlBm()) && schRealInfo.getLpName()
  329 + if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm()) && (schRealInfo.get("lpName")+"")
326 330 .equals(scheduleRealInfo.getLpName())
327   - && schRealInfo.getClZbh().equals(scheduleRealInfo.getClZbh())){
  331 + && (schRealInfo.get("clZbh")+"").equals(scheduleRealInfo.getClZbh())){
328 332 if(scheduleRealInfo.getFcsjActual() == null ||scheduleRealInfo.getBcType().equals("in")
329 333 || scheduleRealInfo.getBcType().equals("out")){
330 334 continue;
... ... @@ -382,22 +386,22 @@ public class TrafficManageServiceImpl implements TrafficManageService{
382 386 StringBuffer sf = new StringBuffer();
383 387 try {
384 388 sf.append("<LCYHS>");
385   - List<ScheduleRealInfo> listGroup = scheduleRealInfoRepository.setLCYHGroup(date);
  389 + List<Map<String,Object>> listGroup = scheduleRealInfoRepository.setLCYHGroup(date);
386 390 List<ScheduleRealInfo> list = scheduleRealInfoRepository.findByDate(date);
387 391 Map<String,Object> map = new HashMap<String,Object>();
388   - for(ScheduleRealInfo schRealInfo:listGroup){
  392 + for(Map<String,Object> schRealInfo:listGroup){
389 393 if(schRealInfo != null){
390 394 //计算总公里和空驶公里,营运公里=总公里-空驶公里
391 395 double totalKilometers = 0,emptyKilometers =0;
392 396 sf.append("<LCYH>");
393   - map.put("insideCode_eq", schRealInfo.getClZbh());
  397 + map.put("insideCode_eq", schRealInfo.get("clZbh")+"");
394 398 Cars car = carsRepository.findOne(new CustomerSpecs<Cars>(map));
395 399 // Cars car = carsRepository.findCarByClzbh(schRealInfo.getClZbh());
396   - sf.append("<RQ>"+schRealInfo.getScheduleDateStr()+"</RQ>");
397   - sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.getXlBm())+"</XLBM>");
  400 + sf.append("<RQ>"+date+"</RQ>");
  401 + sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.get("xlBm"))+"</XLBM>");
398 402 sf.append("<CPH>"+car.getCarPlate()+"</CPH>");
399 403 for(ScheduleRealInfo scheduleRealInfo:list){
400   - if(schRealInfo.getXlBm().equals(scheduleRealInfo.getXlBm()) && schRealInfo.getClZbh()
  404 + if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm()) && (schRealInfo.get("clZbh")+"")
401 405 .equals(scheduleRealInfo.getClZbh())){
402 406 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
403 407 //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班
... ... @@ -428,7 +432,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
428 432 sf.append("<YH>"+""+"</YH>");
429 433 sf.append("<JZYL>"+""+"</JZYL>");
430 434 sf.append("<DH>"+""+"</DH>");
431   - sf.append("<UPDT>"+sdfnyrsfm.format(schRealInfo.getUpdateDate())+"</UPDT>");
  435 + sf.append("<UPDT>"+sdfnyrsfm.format(new Date())+"</UPDT>");
432 436 sf.append("<BBSCBZ>"+0+"</BBSCBZ>");
433 437 sf.append("</LCYH>");
434 438 }
... ... @@ -458,18 +462,18 @@ public class TrafficManageServiceImpl implements TrafficManageService{
458 462 StringBuffer sf = new StringBuffer();
459 463 try {
460 464 sf.append("<DDRBS>");
461   - List<ScheduleRealInfo> listGroup = scheduleRealInfoRepository.setDDRBGroup(date);
  465 + List<Map<String,Object>> listGroup = scheduleRealInfoRepository.setDDRBGroup(date);
462 466 List<ScheduleRealInfo> list = scheduleRealInfoRepository.findByDate(date);
463   - for(ScheduleRealInfo schRealInfo:listGroup){
  467 + for(Map<String,Object> schRealInfo:listGroup){
464 468 if(schRealInfo != null){
465 469 double jhlc = 0,zlc = 0,jhkslc = 0,sjkslc = 0;
466 470 int jhbc = 0,sjbc = 0,jhzgfbc = 0,sjzgfbc = 0,jhwgfbc = 0,sjwgfbc = 0;
467 471 sf.append("<DDRB>");
468   - sf.append("<RQ>"+schRealInfo.getScheduleDateStr()+"</RQ>");
469   - sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.getXlBm())+"</XLBM>");
  472 + sf.append("<RQ>"+date+"</RQ>");
  473 + sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.get("xlBm"))+"</XLBM>");
470 474 for(ScheduleRealInfo scheduleRealInfo:list){
471 475 if(scheduleRealInfo != null){
472   - if(scheduleRealInfo.getXlBm().equals(scheduleRealInfo.getXlBm())){
  476 + if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm())){
473 477 //计划
474 478 if(!scheduleRealInfo.isSflj()){
475 479 jhlc += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc();
... ... @@ -532,7 +536,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
532 536 sf.append("<SJZGFBC>"+sjzgfbc+"</SJZGFBC>");
533 537 sf.append("<JHWGFBC>"+jhwgfbc+"</JHWGFBC>");
534 538 sf.append("<SJWGFBC>"+sjwgfbc+"</SJWGFBC>");
535   - sf.append("<UPDT>"+sdfnyrsfm.format(schRealInfo.getUpdateDate())+"</UPDT>");
  539 + sf.append("<UPDT>"+sdfnyrsfm.format(new Date())+"</UPDT>");
536 540 sf.append("<RBSCBZ>"+0+"</RBSCBZ>");
537 541 sf.append("</DDRB>");
538 542 }
... ... @@ -557,14 +561,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{
557 561 @Override
558 562 public String setJHBC() {
559 563 String result = "failure";
  564 + Line line;
560 565 StringBuffer sBuffer =new StringBuffer();
561 566 try {
562 567 sBuffer.append("<JHBCs>");
563 568 // 声明变量
564   - SchedulePlanInfo schedulePlanInfo = null;
565   - String xlbm = "",zbh = "";
  569 + SchedulePlanInfo schedulePlanInfo;
  570 + String xlbm,zbh = "";
566 571 Long lp = 0L;
567   - int startSerialNum = 0,endSerialNum = 0;;
568 572 // 取明天的日期
569 573 String tomorrow = sdfnyr.format(DateUtils.addDays(new Date(), +1));
570 574 // 查询所有班次
... ... @@ -573,8 +577,13 @@ public class TrafficManageServiceImpl implements TrafficManageService{
573 577 int size = schedulePlanList.size();
574 578 for (int i = 0; i < size; i++) {
575 579 schedulePlanInfo = schedulePlanList.get(i);
  580 + xlbm = schedulePlanInfo.getXlBm();
  581 + // 获取线路是否使用标识,如果未使用,则不查该线路数据
  582 + line = lineRepository.findByLineCode(xlbm);
  583 + if(line.getInUse() == null || line.getInUse() == 0){
  584 + continue;
  585 + }
576 586 if(i == 0){// 第一次,则初始化值
577   - xlbm = schedulePlanInfo.getXlBm();
578 587 zbh = schedulePlanInfo.getClZbh();
579 588 lp = schedulePlanInfo.getLp();
580 589 // 拼装XML
... ... @@ -605,18 +614,28 @@ public class TrafficManageServiceImpl implements TrafficManageService{
605 614 sBuffer.append("</JHBC>");
606 615 }
607 616 }else{
608   - xlbm = schedulePlanInfo.getXlBm();
609 617 zbh = schedulePlanInfo.getClZbh();
610 618 lp = schedulePlanInfo.getLp();
611 619 sBuffer.append("</BCList>");
612 620 sBuffer.append("</JHBC>");
613   - startSerialNum = 0;
614   - endSerialNum = 0;
615 621 // 拼装XML
616 622 assembleJHBC(sBuffer, schedulePlanInfo, xlbm, zbh, lp);
617 623 }
618 624 }
619 625 }
  626 + // 判断XML是否以</BCList>结尾,如果不是,则加上
  627 + String regex = "^*</JHBC>$";
  628 + Pattern p = Pattern.compile(regex);
  629 + java.util.regex.Matcher m = p.matcher(sBuffer);
  630 + boolean isEndWithTrueFlag = false;
  631 + while (m.find()) {
  632 + isEndWithTrueFlag = true;
  633 + }
  634 + // 加上缺失的标签
  635 + if(!isEndWithTrueFlag){
  636 + sBuffer.append("</BCList>");
  637 + sBuffer.append("</JHBC>");
  638 + }
620 639 sBuffer.append("</JHBCs>");
621 640 if(ssop.setJHBC(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
622 641 result = "success";
... ... @@ -643,7 +662,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
643 662 StringBuffer sBufferA;
644 663 StringBuffer sBufferB;
645 664 TTInfo ttInfo;
646   - TTInfoDetail ttInfoDetail = null;
  665 + TTInfoDetail ttInfoDetail;
647 666 Iterator<TTInfoDetail> ttInfoDetailIterator;
648 667 HashMap<String,Object> param = new HashMap<String, Object>();
649 668 String lineCode ;
... ... @@ -1027,6 +1046,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1027 1046 company = "浦东金高公交公司";
1028 1047 }else if(company.equals("南汇公司")){
1029 1048 company = "浦东南汇公交公司";
  1049 + }else if(company.equals("青浦公交")){
  1050 + company = "浦东青浦公交公司";
1030 1051 }
1031 1052 }
1032 1053 /**
... ...
src/main/java/com/bsth/service/oil/impl/YlxxbServiceImpl.java
... ... @@ -52,14 +52,14 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
52 52 // TODO Auto-generated catch block
53 53 e.printStackTrace();
54 54 }
55   - if(map.get("gsdm_in")!=null){
  55 + /*if(map.get("gsdm_in")!=null){
56 56 map.put("ssgsdm_in", map.get("gsdm_in"));
57 57 map.remove("gsdm_in");
58 58  
59 59 }else{
60 60 map.put("ssgsdm_like", map.get("gsdm_like"));
61 61 map.remove("gsdm_like");
62   - }
  62 + }*/
63 63  
64 64 //根具条件查询指定日期Ylb的数据
65 65 List<Ylb> ylbIterator=(List<Ylb>) ylbRepository.findAll(new CustomerSpecs<Ylb>(map));
... ...
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java
1 1 package com.bsth.service.realcontrol.impl;
2 2  
3   -import java.util.Map;
4   -
5   -import javax.transaction.Transactional;
6   -
7   -import org.springframework.beans.factory.annotation.Autowired;
8   -import org.springframework.stereotype.Service;
9   -
10 3 import com.bsth.data.BasicData;
11 4 import com.bsth.data.match.Arrival2Schedule;
12 5 import com.bsth.data.schedule.DayOfSchedule;
13 6 import com.bsth.entity.realcontrol.ChildTaskPlan;
14 7 import com.bsth.entity.realcontrol.ScheduleRealInfo;
15 8 import com.bsth.repository.realcontrol.ChildTaskPlanRepository;
  9 +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
16 10 import com.bsth.service.impl.BaseServiceImpl;
17 11 import com.bsth.service.realcontrol.ChildTaskPlanService;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.jdbc.core.JdbcTemplate;
  14 +import org.springframework.stereotype.Service;
  15 +
  16 +import javax.transaction.Transactional;
  17 +import java.util.Map;
18 18  
19 19 @Service
20 20 public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Long> implements ChildTaskPlanService{
21 21  
22 22 /*@Autowired
23 23 ScheduleRealInfoServiceImpl scheduleRealInfoService;*/
  24 +
  25 + @Autowired
  26 + ScheduleRealInfoRepository scheduleRealInfoRepository;
24 27  
25 28 @Autowired
26 29 ChildTaskPlanRepository childTaskPlanRepository;
... ... @@ -30,6 +33,9 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl&lt;ChildTaskPlan, Lon
30 33  
31 34 @Autowired
32 35 Arrival2Schedule arrival2Schedule;
  36 +
  37 + @Autowired
  38 + JdbcTemplate jdbcTemplate;
33 39  
34 40 @Transactional
35 41 @Override
... ... @@ -62,10 +68,13 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl&lt;ChildTaskPlan, Lon
62 68 //解除和主任务关联
63 69 ScheduleRealInfo sch = dayOfSchedule.get(cPlan.getSchedule().getId());
64 70 sch.getcTasks().remove(cPlan);
  71 + //删除关联表数据
  72 + jdbcTemplate.execute("delete from bsth_c_s_sp_info_real_c_tasks where bsth_c_s_sp_info_real="+sch.getId()+" and c_tasks="+cPlan.getId());
  73 +
65 74 //删除子任务
66 75 rs = super.delete(id);
67 76 dayOfSchedule.save(sch);
68   -
  77 +
69 78 rs.put("t", sch);
70 79 return rs;
71 80 }
... ...
src/main/java/com/bsth/service/schedule/CarDeviceService.java 0 → 100644
  1 +package com.bsth.service.schedule;
  2 +
  3 +import com.bsth.entity.CarDevice;
  4 +
  5 +/**
  6 + * Created by xu on 16/12/15.
  7 + */
  8 +public interface CarDeviceService extends BService<CarDevice, Long> {
  9 + void validate_qyrq(CarDevice carDevice) throws ScheduleException;
  10 +}
... ...
src/main/java/com/bsth/service/schedule/EmployeeService.java 0 → 100644
  1 +package com.bsth.service.schedule;
  2 +
  3 +import com.bsth.entity.Personnel;
  4 +
  5 +/**
  6 + * Created by xu on 16/12/15.
  7 + */
  8 +public interface EmployeeService extends BService<Personnel, Integer> {
  9 + public void validate_gh(Personnel personnel) throws ScheduleException;
  10 +}
... ...
src/main/java/com/bsth/service/schedule/GuideboardInfoService.java
... ... @@ -6,6 +6,8 @@ import com.bsth.entity.schedule.GuideboardInfo;
6 6 * Created by xu on 16/5/11.
7 7 */
8 8 public interface GuideboardInfoService extends BService<GuideboardInfo, Long> {
9   - public void validate(GuideboardInfo guideboardInfo) throws ScheduleException;
  9 + public void validate_lpno(GuideboardInfo guideboardInfo) throws ScheduleException;
  10 + public void validate_lpname(GuideboardInfo guideboardInfo) throws ScheduleException;
10 11 public void toggleCancel(Long id) throws ScheduleException;
  12 +
11 13 }
... ...
src/main/java/com/bsth/service/schedule/PeopleCarPlanServiceImpl.java
... ... @@ -46,7 +46,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
46 46 if(company.length() != 0)
47 47 sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'";
48 48  
49   - list =jdbcTemplate.query(sql,
  49 + list = jdbcTemplate.query(sql,
50 50 new RowMapper<ScheduleRealInfo>(){
51 51 @Override
52 52 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -117,7 +117,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
117 117 sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'";
118 118 }
119 119  
120   - list =jdbcTemplate.query(sql,
  120 + list = jdbcTemplate.query(sql,
121 121 new RowMapper<SchedulePlanInfo>(){
122 122 @Override
123 123 public SchedulePlanInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -362,13 +362,15 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
362 362 }
363 363 ScheduleRealInfo shouban = tempList.get(0);
364 364 ScheduleRealInfo moban = tempList.get(tempList.size() - 1);
  365 +// System.out.println(shouban.getFcsjActual() + "-首班-" + shouban.getFcsj());
  366 +// System.out.println(moban.getFcsjActual() + "-末班-" + moban.getFcsj());
  367 + jhsb++;
365 368 if(shouban.getFcsjActual() != null){
366   - jhsb++;
367 369 if(shouban.getFcsjActualTime() - shouban.getFcsjT() >= -60000 && shouban.getFcsjActualTime() - shouban.getFcsjT() <= 180000)
368 370 sjsb++;
369 371 }
  372 + jhmb++;
370 373 if(moban.getFcsjActual() != null){
371   - jhmb++;
372 374 if(moban.getFcsjActualTime() - moban.getFcsjT() >= -60000 && moban.getFcsjActualTime() - moban.getFcsjT() <= 180000)
373 375 sjmb++;
374 376 }
... ... @@ -452,7 +454,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
452 454 }
453 455 sql += " and bc_type = 'normal'";
454 456  
455   - list =jdbcTemplate.query(sql,
  457 + list = jdbcTemplate.query(sql,
456 458 new RowMapper<ScheduleRealInfo>(){
457 459 @Override
458 460 public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
... ...
src/main/java/com/bsth/service/schedule/impl/CarConfigInfoServiceImpl.java
... ... @@ -36,12 +36,14 @@ public class CarConfigInfoServiceImpl extends BServiceImpl&lt;CarConfigInfo, Long&gt;
36 36 throw new ScheduleException("线路未选择");
37 37 } else {
38 38 // param.put("xl.id_eq", carConfigInfo.getXl().getId());
  39 + param.put("isCancel_eq", false);
39 40 if (carConfigInfo.getCl() == null || carConfigInfo.getCl().getId() == null) {
40 41 throw new ScheduleException("车辆未选择");
41 42 } else {
42 43 param.put("cl.id_eq", carConfigInfo.getCl().getId());
43   - if (!CollectionUtils.isEmpty(list(param))) {
44   - throw new ScheduleException("车辆已经配置在" + carConfigInfo.getXl().getName() + "线路中!");
  44 + List<CarConfigInfo> carConfigInfos = list(param);
  45 + if (!CollectionUtils.isEmpty(carConfigInfos)) {
  46 + throw new ScheduleException("车辆已经配置在" + carConfigInfos.get(0).getXl().getName() + "线路中!");
45 47 }
46 48 }
47 49 }
... ...
src/main/java/com/bsth/service/schedule/impl/CarDeviceServiceImpl.java 0 → 100644
  1 +package com.bsth.service.schedule.impl;
  2 +
  3 +import com.bsth.entity.CarDevice;
  4 +import com.bsth.entity.Cars;
  5 +import com.bsth.service.CarsService;
  6 +import com.bsth.service.schedule.CarDeviceService;
  7 +import com.bsth.service.schedule.ScheduleException;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Service;
  10 +import org.springframework.transaction.annotation.Transactional;
  11 +import org.springframework.util.CollectionUtils;
  12 +
  13 +import java.util.HashMap;
  14 +import java.util.Map;
  15 +
  16 +/**
  17 + * Created by xu on 16/12/15.
  18 + */
  19 +@Service(value = "carDeviceServiceImpl_sc")
  20 +public class CarDeviceServiceImpl extends BServiceImpl<CarDevice, Long> implements CarDeviceService {
  21 + @Autowired
  22 + private CarsService carsService;
  23 +
  24 + @Transactional
  25 + @Override
  26 + public CarDevice save(CarDevice carDevice) {
  27 + // 查找对应的车辆基础信息,更新设备编号数据
  28 + Cars cars = carsService.findById(carDevice.getCl());
  29 + cars.setEquipmentCode(carDevice.getNewDeviceNo());
  30 + return super.save(carDevice);
  31 + }
  32 +
  33 + @Transactional
  34 + @Override
  35 + public void validate_qyrq(CarDevice carDevice) throws ScheduleException {
  36 + if (carDevice.getXl() == null) {
  37 + throw new ScheduleException("线路未选择");
  38 + }
  39 + if (carDevice.getCl() == null) {
  40 + throw new ScheduleException("车辆未选择");
  41 + }
  42 + Map<String, Object> param = new HashMap<>();
  43 + if (carDevice.getId() != null) {
  44 + param.put("id_ne", carDevice.getId());
  45 + }
  46 + param.put("xl_eq", carDevice.getXl());
  47 + param.put("cl_eq", carDevice.getCl());
  48 + param.put("qyrq_ge", carDevice.getQyrq());
  49 + if (!CollectionUtils.isEmpty(list(param))) {
  50 + throw new ScheduleException("启用日期必须比历史的启用日期大");
  51 + }
  52 + }
  53 +
  54 + @Transactional
  55 + @Override
  56 + public void delete(Long aLong) throws ScheduleException {
  57 + toggleCancel(aLong);
  58 + }
  59 +
  60 + @Transactional
  61 + public void toggleCancel(Long id) throws ScheduleException {
  62 + CarDevice carDevice = findById(id);
  63 + if (carDevice.getIsCancel()) {
  64 + carDevice.setIsCancel(false);
  65 + } else {
  66 + carDevice.setIsCancel(true);
  67 + }
  68 + }
  69 +}
... ...
src/main/java/com/bsth/service/schedule/impl/EmployeeConfigInfoServiceImpl.java
... ... @@ -34,12 +34,15 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl&lt;EmployeeConfigIn
34 34 employeeConfigInfo.getXl().getName() == null) {
35 35 throw new ScheduleException("线路未选择");
36 36 } else {
  37 +// param.put("xl.id_eq", employeeConfigInfo.getXl().getId());
  38 + param.put("isCancel_eq", false);
37 39 if (employeeConfigInfo.getJsy() == null || employeeConfigInfo.getJsy().getId() == null) {
38 40 throw new ScheduleException("驾驶员未选择");
39 41 } else {
40 42 param.put("jsy.id_eq", employeeConfigInfo.getJsy().getId());
  43 + List<EmployeeConfigInfo> employeeConfigInfos = list(param);
41 44 if (!CollectionUtils.isEmpty(list(param))) {
42   - throw new ScheduleException("驾驶员已经配置在" + employeeConfigInfo.getXl().getName() + "线路中!");
  45 + throw new ScheduleException("驾驶员已经配置在" + employeeConfigInfos.get(0).getXl().getName() + "线路中!");
43 46 }
44 47 }
45 48 }
... ... @@ -59,12 +62,14 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl&lt;EmployeeConfigIn
59 62 employeeConfigInfo.getXl().getName() == null) {
60 63 throw new ScheduleException("线路未选择");
61 64 } else {
  65 +// param.put("xl.id_eq", employeeConfigInfo.getXl().getId());
62 66 if (employeeConfigInfo.getSpy() == null || employeeConfigInfo.getSpy().getId() == null) {
63 67 throw new ScheduleException("售票员未选择");
64 68 } else {
65 69 param.put("spy.id_eq", employeeConfigInfo.getSpy().getId());
  70 + List<EmployeeConfigInfo> employeeConfigInfos = list(param);
66 71 if (!CollectionUtils.isEmpty(list(param))) {
67   - throw new ScheduleException("售票员已经配置在" + employeeConfigInfo.getXl().getName() + "线路中!");
  72 + throw new ScheduleException("售票员已经配置在" + employeeConfigInfos.get(0).getXl().getName() + "线路中!");
68 73 }
69 74 }
70 75 }
... ... @@ -83,7 +88,9 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl&lt;EmployeeConfigIn
83 88 Map<String, Object> param = new HashMap<>();
84 89 if (employeeConfigInfo.getIsCancel()) {
85 90 validate_jsy(employeeConfigInfo);
86   - validate_spy(employeeConfigInfo);
  91 + if (employeeConfigInfo.getSpy() != null) {
  92 + validate_spy(employeeConfigInfo);
  93 + }
87 94 employeeConfigInfo.setIsCancel(false);
88 95 } else {
89 96 param.clear();
... ...
src/main/java/com/bsth/service/schedule/impl/EmployeeServiceImpl.java 0 → 100644
  1 +package com.bsth.service.schedule.impl;
  2 +
  3 +import com.bsth.entity.Personnel;
  4 +import com.bsth.service.schedule.EmployeeService;
  5 +import com.bsth.service.schedule.ScheduleException;
  6 +import org.springframework.stereotype.Service;
  7 +import org.springframework.transaction.annotation.Transactional;
  8 +import org.springframework.util.CollectionUtils;
  9 +
  10 +import java.util.HashMap;
  11 +import java.util.Map;
  12 +
  13 +/**
  14 + * Created by xu on 16/12/15.
  15 + */
  16 +@Service
  17 +public class EmployeeServiceImpl extends BServiceImpl<Personnel, Integer> implements EmployeeService {
  18 + @Override
  19 + @Transactional
  20 + public void validate_gh(Personnel personnel) throws ScheduleException {
  21 + // 查询条件
  22 + Map<String, Object> param = new HashMap<>();
  23 + if (personnel.getId() != null) {
  24 + param.put("id_ne", personnel.getId());
  25 + }
  26 + param.put("companyCode_eq", personnel.getCompanyCode());
  27 + param.put("jobCode_eq", personnel.getJobCode());
  28 + if (!CollectionUtils.isEmpty(list(param))) {
  29 + throw new ScheduleException("相同公司工号重复");
  30 + }
  31 + }
  32 +}
... ...
src/main/java/com/bsth/service/schedule/impl/GuideboardInfoServiceImpl.java
... ... @@ -22,52 +22,44 @@ public class GuideboardInfoServiceImpl extends BServiceImpl&lt;GuideboardInfo, Long
22 22 @Autowired
23 23 private TTInfoDetailService ttInfoDetailService;
24 24  
25   - // 验证方法
26   - @Transactional
27   - public void validate(GuideboardInfo guideboardInfo) throws ScheduleException {
  25 + @Override
  26 + public void validate_lpno(GuideboardInfo guideboardInfo) throws ScheduleException {
28 27 // 查询条件
29 28 Map<String, Object> param = new HashMap<>();
30   - if (guideboardInfo.getId() != null)
  29 + if (guideboardInfo.getId() != null) {
31 30 param.put("id_ne", guideboardInfo.getId());
  31 + }
32 32  
33 33 if (guideboardInfo.getXl() == null || guideboardInfo.getXl().getId() == null) {
34 34 throw new ScheduleException("线路未选择");
35 35 } else {
  36 + param.put("isCancel_eq", false); // 作废的也算入判定区
36 37 param.put("xl.id_eq", guideboardInfo.getXl().getId());
  38 + param.put("lpNo_eq", guideboardInfo.getLpNo());
  39 + if (!CollectionUtils.isEmpty(list(param))) {
  40 + throw new ScheduleException("路牌编号重复");
  41 + }
  42 + }
  43 + }
37 44  
38   -// param.put("isCancel_eq", false); // 作废的也算入判定区
39   - if (guideboardInfo.getLpNo() != null) {
40   - if (guideboardInfo.getLpName() != null) {
41   - // 如果两个都写了,分开查询
42   - param.put("lpNo_eq", guideboardInfo.getLpNo());
43   - if (!CollectionUtils.isEmpty(list(param))) {
44   - throw new ScheduleException("路牌编号重复");
45   - }
46   - param.remove("lpNo_eq");
47   - param.put("lpName_eq", guideboardInfo.getLpName());
48   - if (!CollectionUtils.isEmpty(list(param))) {
49   - throw new ScheduleException("路牌名称重复");
50   - }
  45 + @Override
  46 + public void validate_lpname(GuideboardInfo guideboardInfo) throws ScheduleException {
  47 + // 查询条件
  48 + Map<String, Object> param = new HashMap<>();
  49 + if (guideboardInfo.getId() != null) {
  50 + param.put("id_ne", guideboardInfo.getId());
  51 + }
51 52  
52   - } else {
53   - param.put("lpNo_eq", guideboardInfo.getLpNo());
54   - if (!CollectionUtils.isEmpty(list(param))) {
55   - throw new ScheduleException("路牌编号重复");
56   - }
57   - }
58   - } else {
59   - if (guideboardInfo.getLpName() != null) {
60   - param.put("lpName_eq", guideboardInfo.getLpName());
61   - if (!CollectionUtils.isEmpty(list(param))) {
62   - throw new ScheduleException("路牌名字重复");
63   - }
64   - } else {
65   - // 都为空
66   - throw new ScheduleException("路牌编号名字都为空");
67   - }
  53 + if (guideboardInfo.getXl() == null || guideboardInfo.getXl().getId() == null) {
  54 + throw new ScheduleException("线路未选择");
  55 + } else {
  56 + param.put("isCancel_eq", false); // 作废的也算入判定区
  57 + param.put("xl.id_eq", guideboardInfo.getXl().getId());
  58 + param.put("lpName_eq", guideboardInfo.getLpName());
  59 + if (!CollectionUtils.isEmpty(list(param))) {
  60 + throw new ScheduleException("路牌名字重复");
68 61 }
69 62 }
70   -
71 63 }
72 64  
73 65 @Transactional
... ... @@ -83,7 +75,8 @@ public class GuideboardInfoServiceImpl extends BServiceImpl&lt;GuideboardInfo, Long
83 75 GuideboardInfo guideboardInfo = findById(id);
84 76 Map<String, Object> param = new HashMap<>();
85 77 if (guideboardInfo.getIsCancel()) {
86   - validate(guideboardInfo);
  78 + validate_lpno(guideboardInfo);
  79 + validate_lpname(guideboardInfo);
87 80 guideboardInfo.setIsCancel(false);
88 81 } else {
89 82 param.clear();
... ... @@ -96,7 +89,7 @@ public class GuideboardInfoServiceImpl extends BServiceImpl&lt;GuideboardInfo, Long
96 89 } else {
97 90 throw new ScheduleException("在时刻表" +
98 91 ttInfoDetailList.get(0).getTtinfo().getName() +
99   - "已使用,无法删除!");
  92 + "已使用,无法作废!");
100 93 }
101 94 }
102 95 }
... ...
src/main/resources/static/pages/base/line/js/line-add-form.js
... ... @@ -94,7 +94,7 @@ $(function(){
94 94 $('#endStationEndTimeInput').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
95 95  
96 96 /** get请求获取公司表数据并填充公司下拉框选择值 */
97   - $get('/business/all', {upCode_eq: '77'}, function(array){
  97 + $get('/business/all', {upCode_eq: '88'}, function(array){
98 98  
99 99 /** 公司下拉options属性值 */
100 100 var options = '<option value="">-- 请选择公司 --</option>';
... ...
src/main/resources/static/pages/base/line/js/line-details-info.js
... ... @@ -47,7 +47,7 @@ $(function(){
47 47 function selectTemp(callback) {
48 48  
49 49 // 填充公司下拉框选择值
50   - $.get('/business/all', {upCode_eq: '77'}, function(array){
  50 + $.get('/business/all', {upCode_eq: '88'}, function(array){
51 51  
52 52 // 公司下拉options属性值
53 53 var options = '<option value="">-- 请选择公司 --</option>';
... ...
src/main/resources/static/pages/base/line/js/line-edit-form.js
... ... @@ -42,7 +42,7 @@
42 42 function selectTemp(callback) {
43 43  
44 44 // 填充公司下拉框选择值
45   - $.get('/business/all', {upCode_eq: '77'}, function(array){
  45 + $.get('/business/all', {upCode_eq: '88'}, function(array){
46 46  
47 47 // 公司下拉options属性值
48 48 var options = '<option value="">-- 请选择公司 --</option>';
... ...
src/main/resources/static/pages/base/line/js/line-list-table.js
... ... @@ -202,7 +202,7 @@
202 202 }
203 203  
204 204 /** 填充公司下拉框选择值 */
205   - $get('/business/all', {upCode_eq: '77'}, function(array){
  205 + $get('/business/all', {upCode_eq: '88'}, function(array){
206 206  
207 207 // 公司下拉options属性值
208 208 var options = '<option value="">请选择...</option>';
... ...
src/main/resources/static/pages/forecast/sample/js/svg.js
... ... @@ -218,6 +218,8 @@ var sampleSvg = (function(){
218 218  
219 219 //分析path d 路径中间点
220 220 function analysePath(d){
  221 + if(!d)
  222 + return [-100, -100];
221 223 d = d.replace('M', '');
222 224 var sp = d.split('L')[0].split(',')
223 225 ,ep = d.split('L')[1].split(',')
... ...
src/main/resources/static/pages/forms/statement/operationservice.html
... ... @@ -79,7 +79,7 @@
79 79 <th>消耗量</th>
80 80 <th>行驶公里(含空放里程)</th>
81 81 <th>空驶里程</th>
82   - <th>实际班次(包含空放班次)</th>
  82 + <th>实际班次(包含空放班次)</th>
83 83 </tr>
84 84 </thead>
85 85 <tbody>
... ... @@ -112,7 +112,6 @@
112 112 text : result[code]
113 113 });
114 114 }
115   - console.log(data);
116 115 initPinYinSelect2('#line', data, '');
117 116  
118 117 })
... ... @@ -199,7 +198,6 @@
199 198 obj.updateDate = moment(obj.startDate).format(
200 199 "YYYY-MM-DD HH:mm:ss");
201 200 });
202   - console.log(result);
203 201 var operationservice = template('operationservice', {
204 202 list : result
205 203 });
... ...
src/main/resources/static/pages/forms/statement/shifday.html
... ... @@ -147,7 +147,6 @@ $(function(){
147 147 for(var code in result){
148 148 data.push({id: code, text: result[code]});
149 149 }
150   - console.log(data);
151 150 initPinYinSelect2('#line',data,'');
152 151  
153 152 })
... ...
src/main/resources/static/pages/forms/statement/shiftuehiclemanth.html
... ... @@ -137,7 +137,6 @@
137 137 for(var code in result){
138 138 data.push({id: code, text: result[code]});
139 139 }
140   - console.log(data);
141 140 initPinYinSelect2('#line',data,'');
142 141  
143 142 })
... ...
src/main/resources/static/pages/forms/statement/singledata.html
... ... @@ -142,7 +142,6 @@
142 142 for(var code in result){
143 143 data.push({id: code, text: result[code]});
144 144 }
145   - console.log(data);
146 145 initPinYinSelect2('#line',data,'');
147 146  
148 147 })
... ... @@ -167,7 +166,6 @@
167 166 }
168 167 obj.updateDate = moment(obj.startDate).format("YYYY-MM-DD HH:mm:ss");
169 168 });
170   - console.log(result);
171 169 var singledata = template('singledata',{list:result});
172 170 // 把渲染好的模版html文本追加到表格中
173 171 $('#forms tbody').html(singledata);
... ...
src/main/resources/static/pages/forms/statement/vehicleloading.html
... ... @@ -130,7 +130,6 @@
130 130 for(var code in result){
131 131 data.push({id: code, text: result[code]});
132 132 }
133   - console.log(data);
134 133 initPinYinSelect2('#line',data,'');
135 134  
136 135 })
... ...
src/main/resources/static/pages/forms/statement/waybillday.html
... ... @@ -129,7 +129,6 @@
129 129 for(var code in result){
130 130 data.push({id: code, text: result[code]});
131 131 }
132   - console.log(data);
133 132 initPinYinSelect2('#line',data,'');
134 133  
135 134 })
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/edit.html
... ... @@ -48,7 +48,7 @@
48 48 required ng-maxlength="20"
49 49 remote-Validation
50 50 remotevtype="cars_zbh"
51   - remotevparam="{{ {'insideCode_eq': ctrl.busInfoForSave.insideCode} | json}}"
  51 + remotevparam="{{ {'id_eq': ctrl.busInfoForSave.id, 'insideCode_eq': ctrl.busInfoForSave.insideCode} | json}}"
52 52 placeholder="请输入车辆内部编码"/>
53 53 </div>
54 54 <!-- 隐藏块,显示验证信息 -->
... ... @@ -66,18 +66,18 @@
66 66 <div class="form-group has-success has-feedback">
67 67 <label class="col-md-2 control-label">所属公司*:</label>
68 68 <div class="col-md-3">
69   - <sa-Select3 model="ctrl.busInfoForSave"
70   - name="gs"
71   - placeholder="请选择所属公司..."
72   - dcvalue="{{ctrl.busInfoForSave.businessCode}}"
  69 + <sa-Select5 name="gs"
  70 + model="ctrl.busInfoForSave"
  71 + cmaps="{'businessCode': 'code', 'company': 'name'}"
73 72 dcname="businessCode"
74 73 icname="code"
75   - dcname2="company"
76   - icname2="name"
77   - icnames="name"
78   - datatype="gsType"
  74 + dsparams="{{ {type: 'dic', param: 'gsType' } | json }}"
  75 + iterobjname="item"
  76 + iterobjexp="item.name"
  77 + searchph="请选择所属公司..."
  78 + searchexp="this.name"
79 79 required >
80   - </sa-Select3>
  80 + </sa-Select5>
81 81  
82 82 </div>
83 83 <!-- 隐藏块,显示验证信息 -->
... ... @@ -108,7 +108,7 @@
108 108 required placeholder="请输入车辆编码"
109 109 remote-Validation
110 110 remotevtype="cars_clbh"
111   - remotevparam="{{ {'carCode_eq': ctrl.busInfoForSave.carCode} | json}}"
  111 + remotevparam="{{ {'id_eq': ctrl.busInfoForSave.id, 'carCode_eq': ctrl.busInfoForSave.carCode} | json}}"
112 112 />
113 113 </div>
114 114 <!-- 隐藏块,显示验证信息 -->
... ... @@ -128,7 +128,7 @@
128 128 required placeholder="请输入车牌号"
129 129 remote-Validation
130 130 remotevtype="cars_cph"
131   - remotevparam="{{ {'carPlate_eq': ctrl.busInfoForSave.carPlate} | json}}"
  131 + remotevparam="{{ {'id_eq': ctrl.busInfoForSave.id, 'carPlate_eq': ctrl.busInfoForSave.carPlate} | json}}"
132 132 />
133 133 </div>
134 134 <!-- 隐藏快,显示验证信息 -->
... ... @@ -143,16 +143,18 @@
143 143 <div class="form-group has-success has-feedback">
144 144 <label class="col-md-2 control-label">设备供应厂商*:</label>
145 145 <div class="col-md-3">
146   - <sa-Select3 model="ctrl.busInfoForSave"
147   - name="supplierName"
148   - placeholder="请选择设备厂商..."
149   - dcvalue="{{ctrl.busInfoForSave.supplierName}}"
  146 + <sa-Select5 name="supplierName"
  147 + model="ctrl.busInfoForSave"
  148 + cmaps="{'supplierName': 'code'}"
150 149 dcname="supplierName"
151 150 icname="code"
152   - icnames="name"
153   - datatype="snames"
  151 + dsparams="{{ {type: 'dic', param: 'snames' } | json }}"
  152 + iterobjname="item"
  153 + iterobjexp="item.name"
  154 + searchph="请选择设备厂商..."
  155 + searchexp="this.name"
154 156 required >
155   - </sa-Select3>
  157 + </sa-Select5>
156 158 </div>
157 159 <!-- 隐藏快,显示验证信息 -->
158 160 <div class="alert alert-danger well-sm" ng-show="myForm.supplierName.$error.required">
... ... @@ -168,7 +170,7 @@
168 170 required placeholder="请输入设备终端号"
169 171 remote-Validation
170 172 remotevtype="cars_sbbh"
171   - remotevparam="{{ {'equipmentCode_eq': ctrl.busInfoForSave.equipmentCode} | json}}"
  173 + remotevparam="{{ {'id_eq': ctrl.busInfoForSave.id, 'equipmentCode_eq': ctrl.busInfoForSave.equipmentCode} | json}}"
172 174 />
173 175 </div>
174 176 <!-- 隐藏块,显示验证信息 -->
... ... @@ -369,45 +371,54 @@
369 371 <div class="form-group">
370 372 <label class="col-md-2 control-label">车辆类型:</label>
371 373 <div class="col-md-3">
372   - <sa-Select3 model="ctrl.busInfoForSave"
373   - name="carType"
374   - placeholder="请选择车辆类型..."
375   - dcvalue="{{ctrl.busInfoForSave.carType}}"
  374 + <sa-Select5 name="carType"
  375 + model="ctrl.busInfoForSave"
  376 + cmaps="{'carType': 'code'}"
376 377 dcname="carType"
377 378 icname="code"
378   - icnames="name"
379   - datatype="carType" >
380   - </sa-Select3>
  379 + dsparams="{{ {type: 'dic', param: 'carType' } | json }}"
  380 + iterobjname="item"
  381 + iterobjexp="item.name"
  382 + searchph="请选择车辆类型..."
  383 + searchexp="this.name"
  384 + >
  385 + </sa-Select5>
381 386 </div>
382 387 </div>
383 388  
384 389 <div class="form-group">
385 390 <label class="col-md-2 control-label">是否机动车:</label>
386 391 <div class="col-md-3">
387   - <sa-Select3 model="ctrl.busInfoForSave"
388   - name="vehicleStats"
389   - placeholder="请选择机动车类型..."
390   - dcvalue="{{ctrl.busInfoForSave.vehicleStats}}"
  392 + <sa-Select5 name="vehicleStats"
  393 + model="ctrl.busInfoForSave"
  394 + cmaps="{'vehicleStats': 'code'}"
391 395 dcname="vehicleStats"
392 396 icname="code"
393   - icnames="name"
394   - datatype="jdcType" >
395   - </sa-Select3>
  397 + dsparams="{{ {type: 'dic', param: 'jdcType' } | json }}"
  398 + iterobjname="item"
  399 + iterobjexp="item.name"
  400 + searchph="请选择机动车类型..."
  401 + searchexp="this.name"
  402 + >
  403 + </sa-Select5>
396 404 </div>
397 405 </div>
398 406  
399 407 <div class="form-group">
400 408 <label class="col-md-2 control-label">营运状态:</label>
401 409 <div class="col-md-3">
402   - <sa-Select3 model="ctrl.busInfoForSave"
403   - name="operatorsState"
404   - placeholder="请选择营运状态..."
405   - dcvalue="{{ctrl.busInfoForSave.operatorsState}}"
  410 + <sa-Select5 name="operatorsState"
  411 + model="ctrl.busInfoForSave"
  412 + cmaps="{'operatorsState': 'code'}"
406 413 dcname="operatorsState"
407 414 icname="code"
408   - icnames="name"
409   - datatype="yyztType" >
410   - </sa-Select3>
  415 + dsparams="{{ {type: 'dic', param: 'yyztType' } | json }}"
  416 + iterobjname="item"
  417 + iterobjexp="item.name"
  418 + searchph="请选择营运状态..."
  419 + searchexp="this.name"
  420 + >
  421 + </sa-Select5>
411 422 </div>
412 423 </div>
413 424  
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/form.html
... ... @@ -66,18 +66,18 @@
66 66 <div class="form-group has-success has-feedback">
67 67 <label class="col-md-2 control-label">所属公司*:</label>
68 68 <div class="col-md-3">
69   - <sa-Select3 model="ctrl.busInfoForSave"
70   - name="gs"
71   - placeholder="请选择所属公司..."
72   - dcvalue="{{ctrl.busInfoForSave.businessCode}}"
  69 + <sa-Select5 name="gs"
  70 + model="ctrl.busInfoForSave"
  71 + cmaps="{'businessCode': 'code', 'company': 'name'}"
73 72 dcname="businessCode"
74 73 icname="code"
75   - dcname2="company"
76   - icname2="name"
77   - icnames="name"
78   - datatype="gsType"
  74 + dsparams="{{ {type: 'dic', param: 'gsType' } | json }}"
  75 + iterobjname="item"
  76 + iterobjexp="item.name"
  77 + searchph="请选择所属公司..."
  78 + searchexp="this.name"
79 79 required >
80   - </sa-Select3>
  80 + </sa-Select5>
81 81  
82 82 </div>
83 83 <!-- 隐藏块,显示验证信息 -->
... ... @@ -143,16 +143,18 @@
143 143 <div class="form-group has-success has-feedback">
144 144 <label class="col-md-2 control-label">设备供应厂商*:</label>
145 145 <div class="col-md-3">
146   - <sa-Select3 model="ctrl.busInfoForSave"
147   - name="supplierName"
148   - placeholder="请选择设备厂商..."
149   - dcvalue="{{ctrl.busInfoForSave.supplierName}}"
  146 + <sa-Select5 name="supplierName"
  147 + model="ctrl.busInfoForSave"
  148 + cmaps="{'supplierName': 'code'}"
150 149 dcname="supplierName"
151 150 icname="code"
152   - icnames="name"
153   - datatype="snames"
  151 + dsparams="{{ {type: 'dic', param: 'snames' } | json }}"
  152 + iterobjname="item"
  153 + iterobjexp="item.name"
  154 + searchph="请选择设备厂商..."
  155 + searchexp="this.name"
154 156 required >
155   - </sa-Select3>
  157 + </sa-Select5>
156 158 </div>
157 159 <!-- 隐藏快,显示验证信息 -->
158 160 <div class="alert alert-danger well-sm" ng-show="myForm.supplierName.$error.required">
... ... @@ -369,45 +371,54 @@
369 371 <div class="form-group">
370 372 <label class="col-md-2 control-label">车辆类型:</label>
371 373 <div class="col-md-3">
372   - <sa-Select3 model="ctrl.busInfoForSave"
373   - name="carType"
374   - placeholder="请选择车辆类型..."
375   - dcvalue="{{ctrl.busInfoForSave.carType}}"
  374 + <sa-Select5 name="carType"
  375 + model="ctrl.busInfoForSave"
  376 + cmaps="{'carType': 'code'}"
376 377 dcname="carType"
377 378 icname="code"
378   - icnames="name"
379   - datatype="carType" >
380   - </sa-Select3>
  379 + dsparams="{{ {type: 'dic', param: 'carType' } | json }}"
  380 + iterobjname="item"
  381 + iterobjexp="item.name"
  382 + searchph="请选择车辆类型..."
  383 + searchexp="this.name"
  384 + >
  385 + </sa-Select5>
381 386 </div>
382 387 </div>
383 388  
384 389 <div class="form-group">
385 390 <label class="col-md-2 control-label">是否机动车:</label>
386 391 <div class="col-md-3">
387   - <sa-Select3 model="ctrl.busInfoForSave"
388   - name="vehicleStats"
389   - placeholder="请选择机动车类型..."
390   - dcvalue="{{ctrl.busInfoForSave.vehicleStats}}"
  392 + <sa-Select5 name="vehicleStats"
  393 + model="ctrl.busInfoForSave"
  394 + cmaps="{'vehicleStats': 'code'}"
391 395 dcname="vehicleStats"
392 396 icname="code"
393   - icnames="name"
394   - datatype="jdcType" >
395   - </sa-Select3>
  397 + dsparams="{{ {type: 'dic', param: 'jdcType' } | json }}"
  398 + iterobjname="item"
  399 + iterobjexp="item.name"
  400 + searchph="请选择机动车类型..."
  401 + searchexp="this.name"
  402 + >
  403 + </sa-Select5>
396 404 </div>
397 405 </div>
398 406  
399 407 <div class="form-group">
400 408 <label class="col-md-2 control-label">营运状态:</label>
401 409 <div class="col-md-3">
402   - <sa-Select3 model="ctrl.busInfoForSave"
403   - name="operatorsState"
404   - placeholder="请选择营运状态..."
405   - dcvalue="{{ctrl.busInfoForSave.operatorsState}}"
  410 + <sa-Select5 name="operatorsState"
  411 + model="ctrl.busInfoForSave"
  412 + cmaps="{'operatorsState': 'code'}"
406 413 dcname="operatorsState"
407 414 icname="code"
408   - icnames="name"
409   - datatype="yyztType" >
410   - </sa-Select3>
  415 + dsparams="{{ {type: 'dic', param: 'yyztType' } | json }}"
  416 + iterobjname="item"
  417 + iterobjexp="item.name"
  418 + searchph="请选择营运状态..."
  419 + searchexp="this.name"
  420 + >
  421 + </sa-Select5>
411 422 </div>
412 423 </div>
413 424  
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/list.html
... ... @@ -30,15 +30,18 @@
30 30 </td>
31 31 <td>
32 32 <div>
33   - <sa-Select3 model="ctrl.searchCondition()"
34   - name="gs"
35   - placeholder="请选择..."
36   - dcvalue="{{ctrl.searchCondition().businessCode_eq}}"
  33 + <sa-Select5 name="gs"
  34 + model="ctrl.searchCondition()"
  35 + cmaps="{'businessCode_eq': 'code'}"
37 36 dcname="businessCode_eq"
38 37 icname="code"
39   - icnames="name"
40   - datatype="gsType">
41   - </sa-Select3>
  38 + dsparams="{{ {type: 'dic', param: 'gsType' } | json }}"
  39 + iterobjname="item"
  40 + iterobjexp="item.name"
  41 + searchph="选择公司..."
  42 + searchexp="this.name"
  43 + >
  44 + </sa-Select5>
42 45 </div>
43 46 </td>
44 47 <td>
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/module.js
... ... @@ -247,9 +247,7 @@ angular.module(&#39;ScheduleApp&#39;).controller(
247 247 // 提交方法
248 248 self.submit = function() {
249 249 console.log(self.busInfoForSave);
250   - //if (self.busInfoForSave) {
251   - // delete $stateParams.id;
252   - //}
  250 + // 保存或者更新
253 251 self.busInfoForSave.$save(function() {
254 252 $state.go("busInfoManage");
255 253 });
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/service.js
1 1 // 车辆信息service
2   -angular.module('ScheduleApp').factory('BusInfoManageService_g', ['$resource', function($resource) {
3   - return {
4   - rest: $resource(
5   - '/cars_sc/:id',
6   - {order: 'carCode', direction: 'ASC', id: '@id_route'},
7   - {
8   - list: {
9   - method: 'GET',
10   - params: {
11   - page: 0
12   - },
13   - transformResponse: function(rs) {
14   - var dst = angular.fromJson(rs);
15   - if (dst.status == 'SUCCESS') {
16   - return dst.data;
17   - } else {
18   - return dst; // 业务错误留给控制器处理
  2 +angular.module('ScheduleApp').factory(
  3 + 'BusInfoManageService_g',
  4 + [
  5 + '$resource',
  6 + function($resource) {
  7 + return {
  8 + rest: $resource(
  9 + '/cars_sc/:id',
  10 + {order: 'carCode', direction: 'ASC', id: '@id'},
  11 + {
  12 + list: {
  13 + method: 'GET',
  14 + params: {
  15 + page: 0
  16 + },
  17 + transformResponse: function(rs) {
  18 + var dst = angular.fromJson(rs);
  19 + if (dst.status == 'SUCCESS') {
  20 + return dst.data;
  21 + } else {
  22 + return dst; // 业务错误留给控制器处理
  23 + }
  24 + }
  25 + },
  26 + get: {
  27 + method: 'GET',
  28 + transformResponse: function(rs) {
  29 + var dst = angular.fromJson(rs);
  30 + if (dst.status == 'SUCCESS') {
  31 + return dst.data;
  32 + } else {
  33 + return dst;
  34 + }
  35 + }
  36 + },
  37 + save: {
  38 + method: 'POST'
19 39 }
20 40 }
21   - },
22   - get: {
23   - method: 'GET',
24   - transformResponse: function(rs) {
25   - var dst = angular.fromJson(rs);
26   - if (dst.status == 'SUCCESS') {
27   - return dst.data;
28   - } else {
29   - return dst;
  41 + ),
  42 + import: $resource(
  43 + '/cars/importfile',
  44 + {},
  45 + {
  46 + do: {
  47 + method: 'POST',
  48 + headers: {
  49 + 'Content-Type': 'application/x-www-form-urlencoded'
  50 + },
  51 + transformRequest: function(obj) {
  52 + var str = [];
  53 + for (var p in obj) {
  54 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  55 + }
  56 + return str.join("&");
  57 + }
30 58 }
31 59 }
32   - },
33   - save: {
34   - method: 'POST'
35   - }
36   - }
37   - ),
38   - import: $resource(
39   - '/cars/importfile',
40   - {},
41   - {
42   - do: {
43   - method: 'POST',
44   - headers: {
45   - 'Content-Type': 'application/x-www-form-urlencoded'
46   - },
47   - transformRequest: function(obj) {
48   - var str = [];
49   - for (var p in obj) {
50   - str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  60 + ),
  61 + dataTools: $resource(
  62 + '/cars/:type',
  63 + {},
  64 + {
  65 + dataExport: {
  66 + method: 'GET',
  67 + responseType: "arraybuffer",
  68 + params: {
  69 + type: "dataExport"
  70 + },
  71 + transformResponse: function(data, headers){
  72 + return {data : data};
  73 + }
51 74 }
52   - return str.join("&");
53 75 }
54   - }
55   - }
56   - ),
57   - validate: $resource(
58   - '/cars/validate/:type',
59   - {},
60   - {
61   - insideCode: {
62   - method: 'GET'
63   - }
64   - }
65   - ),
66   - dataTools: $resource(
67   - '/cars/:type',
68   - {},
69   - {
70   - dataExport: {
71   - method: 'GET',
72   - responseType: "arraybuffer",
73   - params: {
74   - type: "dataExport"
75   - },
76   - transformResponse: function(data, headers){
77   - return {data : data};
78   - }
79   - }
80   - }
81   - )
82   - };
83   -}]);
84 76 \ No newline at end of file
  77 + )
  78 + };
  79 +
  80 + }
  81 + ]
  82 +);
85 83 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/edit.html
... ... @@ -147,7 +147,7 @@
147 147 ng-model="ctrl.deviceInfoForSave.qyrq" readonly
148 148 remote-Validation
149 149 remotevtype="cde1"
150   - remotevparam="{{ {'qyrq': ctrl.deviceInfoForSave.qyrq, 'xl': ctrl.deviceInfoForSave.xl, 'cl': ctrl.deviceInfoForSave.cl} | json}}"/>
  150 + remotevparam="{{ {'id_eq': ctrl.deviceInfoForSave.id, 'qyrq_eq': ctrl.deviceInfoForSave.qyrq, 'xl_eq': ctrl.deviceInfoForSave.xl, 'cl_eq': ctrl.deviceInfoForSave.cl} | json}}"/>
151 151 <span class="input-group-btn">
152 152 <button type="button" class="btn btn-default" ng-click="ctrl.qyrq_open()">
153 153 <i class="glyphicon glyphicon-calendar"></i>
... ... @@ -160,7 +160,7 @@
160 160 启用日期必须选择
161 161 </div>
162 162 <div class="alert alert-danger well-sm" ng-show="myForm.qyrq.$error.remote">
163   - 启用日期必须比历史的启用日期大
  163 + {{$remote_msg}}
164 164 </div>
165 165 </div>
166 166  
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/form.html
... ... @@ -147,7 +147,7 @@
147 147 ng-model="ctrl.deviceInfoForSave.qyrq" readonly
148 148 remote-Validation
149 149 remotevtype="cde1"
150   - remotevparam="{{ {'qyrq': ctrl.deviceInfoForSave.qyrq, 'xl': ctrl.deviceInfoForSave.xl, 'cl': ctrl.deviceInfoForSave.cl} | json}}"/>
  150 + remotevparam="{{ {'qyrq_eq': ctrl.deviceInfoForSave.qyrq, 'xl_eq': ctrl.deviceInfoForSave.xl, 'cl_eq': ctrl.deviceInfoForSave.cl} | json}}"/>
151 151 <span class="input-group-btn">
152 152 <button type="button" class="btn btn-default" ng-click="ctrl.qyrq_open()">
153 153 <i class="glyphicon glyphicon-calendar"></i>
... ... @@ -160,7 +160,7 @@
160 160 启用日期必须选择
161 161 </div>
162 162 <div class="alert alert-danger well-sm" ng-show="myForm.qyrq.$error.remote">
163   - 启用日期必须比历史的启用日期大
  163 + {{$remote_msg}}
164 164 </div>
165 165 </div>
166 166  
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/list.html
... ... @@ -12,7 +12,8 @@
12 12 <th>新设备编号</th>
13 13 <th>旧SIM卡</th>
14 14 <th>新SIM卡</th>
15   - <th style="width: 180px;">创建时间</th>
  15 + <th style="width: 180px;">更新时间</th>
  16 + <th style="width: 80px;" >状态</th>
16 17 <th style="width: 150pt;">操作</th>
17 18 </tr>
18 19 <tr role="row" class="filter">
... ... @@ -41,19 +42,24 @@
41 42 <td></td>
42 43 <td></td>
43 44 <td>
  45 + <label class="checkbox-inline input">
  46 + <input type="checkbox" ng-model="ctrl.searchCondition()['isCancel_eq']" />已作废
  47 + </label>
  48 + </td>
  49 + <td>
44 50 <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
45   - ng-click="ctrl.pageChanaged()">
  51 + ng-click="ctrl.doPage()">
46 52 <i class="fa fa-search"></i> 搜索</button>
47 53  
48 54 <button class="btn btn-sm red btn-outline filter-cancel"
49   - ng-click="ctrl.resetSearchCondition()">
  55 + ng-click="ctrl.reset()">
50 56 <i class="fa fa-times"></i> 重置</button>
51 57 </td>
52 58  
53 59 </tr>
54 60 </thead>
55 61 <tbody>
56   - <tr ng-repeat="info in ctrl.pageInfo.infos" ng-class="{odd: true, gradeX: true, danger: info.isCancel}">
  62 + <tr ng-repeat="info in ctrl.page()['content']" ng-class="{odd: true, gradeX: true, danger: info.isCancel}">
57 63 <td>
58 64 <span ng-bind="$index + 1"></span>
59 65 </td>
... ... @@ -79,15 +85,19 @@
79 85 <span ng-bind="info.newSimNo"></span>
80 86 </td>
81 87 <td>
82   - <span ng-bind="info.createDate | date:'yyyy-MM-dd HH:mm:ss'"></span>
  88 + <span ng-bind="info.updateDate | date:'yyyy-MM-dd HH:mm:ss'"></span>
  89 + </td>
  90 + <td>
  91 + <span class="glyphicon glyphicon-ok" ng-if="info.isCancel == '0'"></span>
  92 + <span class="glyphicon glyphicon-remove" ng-if="info.isCancel == '1'"></span>
83 93 </td>
84 94 <td>
85 95 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
86 96 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
87 97 <a ui-sref="deviceInfoManage_detail({id: info.id})" class="btn btn-info btn-sm"> 详细 </a>
88 98 <a ui-sref="deviceInfoManage_edit({id: info.id})" class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 修改 </a>
89   - <a ng-click="ctrl.toggleCde(info.id)" class="btn btn-danger btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
90   - <a ng-click="ctrl.toggleCde(info.id)" class="btn btn-success btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
  99 + <a ng-click="ctrl.toggleCarDevice(info.id)" class="btn btn-danger btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
  100 + <a ng-click="ctrl.toggleCarDevice(info.id)" class="btn btn-success btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
91 101 </td>
92 102 </tr>
93 103 </tbody>
... ... @@ -96,9 +106,9 @@
96 106 </div>
97 107  
98 108 <div style="text-align: right;">
99   - <uib-pagination total-items="ctrl.pageInfo.totalItems"
100   - ng-model="ctrl.pageInfo.currentPage"
101   - ng-change="ctrl.pageChanaged()"
  109 + <uib-pagination total-items="ctrl.page()['totalElements']"
  110 + ng-model="ctrl.page()['uiNumber']"
  111 + ng-change="ctrl.doPage()"
102 112 rotate="false"
103 113 max-size="10"
104 114 boundary-links="true"
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/module.js
1 1 // 设备信息维护 service controller 等写在一起
2 2  
3   -angular.module('ScheduleApp').factory('DeviceInfoManageService', ['DeviceInfoManageService_g', function(service) {
4   - /** 当前的查询条件信息 */
5   - var currentSearchCondition = {};
6   -
7   - /** 当前第几页 */
8   - var currentPageNo = 1;
9   -
10   - return {
11   - /**
12   - * 获取查询条件信息,
13   - * 用于给controller用来和页面数据绑定。
14   - */
15   - getSearchCondition: function() {
16   - return currentSearchCondition;
17   - },
18   - /**
19   - * 重置查询条件信息。
20   - */
21   - resetSearchCondition: function() {
22   - var key;
23   - for (key in currentSearchCondition) {
24   - currentSearchCondition[key] = "";
25   - }
26   - },
27   - /**
28   - * 设置当前页码。
29   - * @param cpn 从1开始,后台是从0开始的
30   - */
31   - setCurrentPageNo: function(cpn) {
32   - currentPageNo = cpn;
33   - },
34   - /**
35   - * 组装查询参数,返回一个promise查询结果。
36   - * @param params 查询参数
37   - * @return 返回一个 promise
38   - */
39   - getPage: function() {
40   - var params = currentSearchCondition; // 查询条件
41   - params.page = currentPageNo - 1; // 服务端页码从0开始
42   - return service.list(params).$promise;
43   - },
44   - /**
45   - * 获取明细信息。
46   - * @param id 车辆id
47   - * @return 返回一个 promise
48   - */
49   - getDetail: function(id) {
50   - var params = {id: id};
51   - return service.get(params).$promise;
52   - },
53   - /**
54   - * 保存信息。
55   - * @param obj 车辆详细信息
56   - * @return 返回一个 promise
57   - */
58   - saveDetail: function(obj) {
59   - return service.save(obj).$promise;
60   - },
61   - /**
62   - * 删除信息。
63   - * @param id 主键id
64   - * @returns {*|Function|promise|n}
65   - */
66   - deleteDetail: function(id) {
67   - return service.delete({id: id}).$promise;
  3 +angular.module('ScheduleApp').factory(
  4 + 'DeviceInfoManageService',
  5 + [
  6 + 'DeviceInfoManageService_g',
  7 + function(service) {
  8 + /** 当前的查询条件信息 */
  9 + var currentSearchCondition = {'isCancel_eq': false};
  10 +
  11 + // 当前查询返回的信息
  12 + var currentPage = { // 后台spring data返回的格式
  13 + totalElements: 0,
  14 + number: 0, // 后台返回的页码,spring返回从0开始
  15 + content: [],
  16 +
  17 + uiNumber: 1 // 页面绑定的页码
  18 + };
  19 +
  20 + // 查询对象
  21 + var queryClass = service;
  22 +
  23 + return {
  24 + getQueryClass: function() {
  25 + return queryClass;
  26 + },
  27 + getSearchCondition: function() {
  28 + currentSearchCondition.page = currentPage.uiNumber - 1;
  29 + return currentSearchCondition;
  30 + },
  31 + getPage: function(page) {
  32 + if (page) {
  33 + currentPage.totalElements = page.totalElements;
  34 + currentPage.number = page.number;
  35 + currentPage.content = page.content;
  36 + }
  37 + return currentPage;
  38 + },
  39 + resetStatus: function() {
  40 + currentSearchCondition = {page: 0, 'isCancel_eq': false};
  41 + currentPage = {
  42 + totalElements: 0,
  43 + number: 0,
  44 + content: [],
  45 + uiNumber: 1
  46 + };
  47 + }
  48 +
  49 + };
  50 +
68 51 }
69   - };
70   -
71   -}]);
72   -
73   -angular.module('ScheduleApp').controller('DeviceInfoManageCtrl', ['DeviceInfoManageService', '$state', function(deviceInfoManageService, $state) {
74   - var self = this;
75   -
76   - // 切换到form状态
77   - self.goForm = function() {
78   - //alert("切换");
79   - $state.go("deviceInfoManage_form");
80   - }
81   -
82   -
83   -}]);
84   -
85   -angular.module('ScheduleApp').controller('DeviceInfoManageListCtrl', ['DeviceInfoManageService', function(deviceInfoManageService) {
86   - var self = this;
87   - self.pageInfo = {
88   - totalItems : 0,
89   - currentPage : 1,
90   - infos: []
91   - };
92   -
93   - // 初始创建的时候,获取一次列表数据
94   - deviceInfoManageService.getPage().then(
95   - function(result) {
96   - self.pageInfo.totalItems = result.totalElements;
97   - self.pageInfo.currentPage = result.number + 1;
98   - self.pageInfo.infos = result.content;
99   - deviceInfoManageService.setCurrentPageNo(result.number + 1);
100   - },
101   - function(result) {
102   - alert("出错啦!");
  52 + ]
  53 +);
  54 +
  55 +// index.html控制器
  56 +angular.module('ScheduleApp').controller(
  57 + 'DeviceInfoManageCtrl',
  58 + [
  59 + 'DeviceInfoManageService',
  60 + '$state',
  61 + function(service, $state) {
  62 + var self = this;
  63 +
  64 + // 切换到form状态
  65 + self.goForm = function() {
  66 + //alert("切换");
  67 + $state.go("deviceInfoManage_form");
  68 + };
  69 +
103 70 }
104   - );
105   -
106   - // 翻页的时候调用
107   - self.pageChanaged = function() {
108   - deviceInfoManageService.setCurrentPageNo(self.pageInfo.currentPage);
109   - deviceInfoManageService.getPage().then(
110   - function(result) {
111   - self.pageInfo.totalItems = result.totalElements;
112   - self.pageInfo.currentPage = result.number + 1;
113   - self.pageInfo.infos = result.content;
114   - deviceInfoManageService.setCurrentPageNo(result.number + 1);
115   - },
116   - function(result) {
117   - alert("出错啦!");
118   - }
119   - );
120   - };
121   - // 获取查询条件数据
122   - self.searchCondition = function() {
123   - return deviceInfoManageService.getSearchCondition();
124   - };
125   - // 重置查询条件
126   - self.resetSearchCondition = function() {
127   - deviceInfoManageService.resetSearchCondition();
128   - self.pageInfo.currentPage = 1;
129   - self.pageChanaged();
130   - };
131   -
132   - // 作废/撤销
133   - self.toggleCde = function(id) {
134   - // TODO:
135   - deviceInfoManageService.deleteDetail(id).then(
136   - function(result) {
137   - if (result.message) { // 暂时这样做,之后全局拦截
138   - alert("失败:" + result.message);
139   - } else {
140   - alert("成功!");
141   -
142   - deviceInfoManageService.getPage().then(
143   - function(result) {
144   - self.pageInfo.totalItems = result.totalElements;
145   - self.pageInfo.currentPage = result.number + 1;
146   - self.pageInfo.infos = result.content;
147   - deviceInfoManageService.setCurrentPageNo(result.number + 1);
148   - },
149   - function(result) {
150   - alert("出错啦!");
151   - }
152   - );
153   - }
  71 + ]
  72 +);
  73 +
  74 +// list.html控制器
  75 +angular.module('ScheduleApp').controller(
  76 + 'DeviceInfoManageListCtrl',
  77 + [
  78 + 'DeviceInfoManageService',
  79 + function(service) {
  80 + var self = this;
  81 + var CarDevice = service.getQueryClass();
  82 +
  83 + self.page = function() {
  84 + return service.getPage();
  85 + };
  86 +
  87 + self.searchCondition = function() {
  88 + return service.getSearchCondition();
  89 + };
  90 +
  91 + self.doPage = function() {
  92 + var page = CarDevice.list(self.searchCondition(), function() {
  93 + service.getPage(page);
  94 + });
  95 + };
  96 + self.reset = function() {
  97 + service.resetStatus();
  98 + var page = CarDevice.list(self.searchCondition(), function() {
  99 + service.getPage(page);
  100 + });
  101 + };
  102 + self.toggleCarDevice = function(id) {
  103 + CarDevice.delete({id: id}, function(result) {
  104 + if (result.msg) { // 暂时这样做,之后全局拦截
  105 + alert("失败:" + result.msg);
  106 + } else {
  107 + self.doPage();
  108 + }
  109 + });
  110 + };
  111 +
  112 + self.doPage();
154 113  
155   - },
156   - function(result) {
157   - alert("出错啦!" + result);
158   - }
159   - );
160   - };
161   -
162   -}]);
163   -
164   -angular.module('ScheduleApp').controller('DeviceInfoManageFormCtrl', ['DeviceInfoManageService', '$stateParams', '$state', function(deviceInfoManageService, $stateParams, $state) {
165   - var self = this;
166   -
167   - // 启用日期 日期控件开关
168   - self.qyrqOpen = false;
169   - self.qyrq_open = function() {
170   - self.qyrqOpen = true;
171   - };
172   -
173   - // 欲保存的busInfo信息,绑定
174   - self.deviceInfoForSave = {};
175   -
176   - // 获取传过来的id,有的话就是修改,获取一遍数据
177   - var id = $stateParams.id;
178   - if (id) {
179   - self.deviceInfoForSave.id = id;
180   - deviceInfoManageService.getDetail(id).then(
181   - function(result) {
182   - var key;
183   - for (key in result) {
184   - self.deviceInfoForSave[key] = result[key];
185   - }
186   - // 填写所有的 select 控件选中框数据
187   - // 公司字典
188   - if (self.deviceInfoForSave.gsName) {
189   - angular.forEach(self.gses, function(data) {
190   - if (self.deviceInfoForSave.gsName == data.gsmc) {
191   - self.deviceInfoForSave.gs_selected = data;
192   - }
193   - });
194   - }
195   - },
196   - function(result) {
197   - alert("出错啦!");
  114 +
  115 + }
  116 + ]
  117 +);
  118 +
  119 +// form.html控制器
  120 +angular.module('ScheduleApp').controller(
  121 + 'DeviceInfoManageFormCtrl',
  122 + [
  123 + 'DeviceInfoManageService',
  124 + '$stateParams',
  125 + '$state',
  126 + function(service, $stateParams, $state) {
  127 + var self = this;
  128 + var CarDevice = service.getQueryClass();
  129 +
  130 + // 启用日期 日期控件开关
  131 + self.qyrqOpen = false;
  132 + self.qyrq_open = function() {
  133 + self.qyrqOpen = true;
  134 + };
  135 +
  136 + // 欲保存的busInfo信息,绑定
  137 + self.deviceInfoForSave = new CarDevice;
  138 +
  139 + // 获取传过来的id,有的话就是修改,获取一遍数据
  140 + var id = $stateParams.id;
  141 + if (id) {
  142 + CarDevice.get({id: id}, function(value) {
  143 + self.deviceInfoForSave = value;
  144 + });
198 145 }
199   - );
200   - }
201   -
202   - // 提交方法
203   - self.submit = function() {
204   - console.log(self.deviceInfoForSave);
205   - deviceInfoManageService.saveDetail(self.deviceInfoForSave).then(
206   - function(result) {
207   - // TODO:弹出框方式以后改
208   - if (result.status == 'SUCCESS') {
209   - alert("保存成功!");
  146 +
  147 + // 提交方法
  148 + self.submit = function() {
  149 + console.log(self.deviceInfoForSave);
  150 +
  151 + // 保存或者更新
  152 + self.deviceInfoForSave.$save(function() {
210 153 $state.go("deviceInfoManage");
211   - } else {
212   - alert("保存异常!");
213   - }
214   - },
215   - function(result) {
216   - // TODO:弹出框方式以后改
217   - alert("出错啦!");
218   - }
219   - );
220   - };
221   -
222   -}]);
223   -
224   -angular.module('ScheduleApp').controller('DeviceInfoManageDetailCtrl', ['DeviceInfoManageService', '$stateParams', function(deviceInfoManageService, $stateParams) {
225   - var self = this;
226   - self.title = "";
227   - self.deviceInfoForDetail = {};
228   - self.deviceInfoForDetail.id = $stateParams.id;
229   -
230   - // 当转向到此页面时,就获取明细信息并绑定
231   - deviceInfoManageService.getDetail($stateParams.id).then(
232   - function(result) {
233   - var key;
234   - for (key in result) {
235   - self.deviceInfoForDetail[key] = result[key];
236   - }
  154 + });
  155 + };
  156 +
  157 + }
  158 + ]
  159 +);
  160 +
  161 +// detail.html控制器
  162 +angular.module('ScheduleApp').controller(
  163 + 'DeviceInfoManageDetailCtrl',
  164 + [
  165 + 'DeviceInfoManageService',
  166 + '$stateParams',
  167 + function(service, $stateParams) {
  168 + var self = this;
  169 + var CarDevice = service.getQueryClass();
  170 + var id = $stateParams.id;
  171 +
  172 + self.title = "";
  173 + self.deviceInfoForDetail = {};
  174 +
  175 + // 当转向到此页面时,就获取明细信息并绑定
  176 + CarDevice.get({id: id}, function(value) {
  177 + self.deviceInfoForDetail = value;
  178 + self.title = "车辆 " +
  179 + self.deviceInfoForDetail.clZbh +
  180 + "设备信息";
  181 + });
237 182  
238   - self.title = "车辆 " + self.deviceInfoForDetail.clZbh + "设备信息";
239   - },
240   - function(result) {
241   - // TODO:弹出框方式以后改
242   - alert("出错啦!");
243 183 }
244   - );
245   -}]);
246 184 \ No newline at end of file
  185 + ]
  186 +);
247 187 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/service.js
1 1 // 车辆设备信息service
2 2 angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) {
3 3 return $resource(
4   - '/cde/:id',
5   - {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id_route'},
  4 + '/cde_sc/:id',
  5 + {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id'},
6 6 {
7 7 list: {
8 8 method: 'GET',
9 9 params: {
10 10 page: 0
  11 + },
  12 + transformResponse: function(rs) {
  13 + var dst = angular.fromJson(rs);
  14 + if (dst.status == 'SUCCESS') {
  15 + return dst.data;
  16 + } else {
  17 + return dst; // 业务错误留给控制器处理
  18 + }
11 19 }
12 20 },
13 21 get: {
14   - method: 'GET'
  22 + method: 'GET',
  23 + transformResponse: function(rs) {
  24 + var dst = angular.fromJson(rs);
  25 + if (dst.status == 'SUCCESS') {
  26 + return dst.data;
  27 + } else {
  28 + return dst;
  29 + }
  30 + }
15 31 },
16 32 save: {
17 33 method: 'POST'
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/edit.html
... ... @@ -36,18 +36,18 @@
36 36 <div class="form-group has-success has-feedback">
37 37 <label class="col-md-2 control-label">所属公司*:</label>
38 38 <div class="col-md-3">
39   - <sa-Select3 model="ctrl.employeeInfoForSave"
40   - name="gs"
41   - placeholder="请选择所属公司..."
42   - dcvalue="{{ctrl.employeeInfoForSave.companyCode}}"
  39 + <sa-Select5 name="gs"
  40 + model="ctrl.employeeInfoForSave"
  41 + cmaps="{'companyCode': 'code', 'company': 'name'}"
43 42 dcname="companyCode"
44 43 icname="code"
45   - dcname2="company"
46   - icname2="name"
47   - icnames="name"
48   - datatype="gsType"
  44 + dsparams="{{ {type: 'dic', param: 'gsType' } | json }}"
  45 + iterobjname="item"
  46 + iterobjexp="item.name"
  47 + searchph="请输拼音..."
  48 + searchexp="this.name"
49 49 required >
50   - </sa-Select3>
  50 + </sa-Select5>
51 51 </div>
52 52 <!-- 隐藏块,显示验证信息 -->
53 53 <div class="alert alert-danger well-sm" ng-show="myForm.gs.$error.required">
... ... @@ -74,15 +74,17 @@
74 74 <div class="col-md-3">
75 75 <input type="text" class="form-control"
76 76 name="jobCode" ng-model="ctrl.employeeInfoForSave.jobCode"
77   - remote-Validaton rvtype="jobCode" rv1="{{ctrl.employeeInfoForSave.companyCode}}"
78   - required placeholder="请输入工号"/>
  77 + required placeholder="请输入工号"
  78 + remote-Validation
  79 + remotevtype="ee_gh"
  80 + remotevparam="{{ {'id_eq': ctrl.employeeInfoForSave.id, 'companyCode_eq' : ctrl.employeeInfoForSave.companyCode, 'jobCode_eq': ctrl.employeeInfoForSave.jobCode} | json}}"/>
79 81 </div>
80 82 <!-- 隐藏块,显示验证信息 -->
81 83 <div class="alert alert-danger well-sm" ng-show="myForm.jobCode.$error.required">
82 84 工号必须填写
83 85 </div>
84 86 <div class="alert alert-danger well-sm" ng-show="myForm.jobCode.$error.remote">
85   - 选择公司并且相同公司工号不能重复
  87 + {{$remote_msg}}
86 88 </div>
87 89 </div>
88 90  
... ... @@ -125,15 +127,18 @@
125 127 <div class="form-group">
126 128 <label class="col-md-2 control-label">工种:</label>
127 129 <div class="col-md-4">
128   - <sa-Select3 model="ctrl.employeeInfoForSave"
129   - name="posts"
130   - placeholder="请选择工种..."
131   - dcvalue="{{ctrl.employeeInfoForSave.posts}}"
  130 + <sa-Select5 name="posts"
  131 + model="ctrl.employeeInfoForSave"
  132 + cmaps="{'posts': 'code'}"
132 133 dcname="posts"
133 134 icname="code"
134   - icnames="name"
135   - datatype="gzType">
136   - </sa-Select3>
  135 + dsparams="{{ {type: 'dic', param: 'gzType' } | json }}"
  136 + iterobjname="item"
  137 + iterobjexp="item.name"
  138 + searchph="请输拼音..."
  139 + searchexp="this.name"
  140 + >
  141 + </sa-Select5>
137 142 </div>
138 143 </div>
139 144  
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/form.html
... ... @@ -36,18 +36,18 @@
36 36 <div class="form-group has-success has-feedback">
37 37 <label class="col-md-2 control-label">所属公司*:</label>
38 38 <div class="col-md-3">
39   - <sa-Select3 model="ctrl.employeeInfoForSave"
40   - name="gs"
41   - placeholder="请选择所属公司..."
42   - dcvalue="{{ctrl.employeeInfoForSave.companyCode}}"
  39 + <sa-Select5 name="gs"
  40 + model="ctrl.employeeInfoForSave"
  41 + cmaps="{'companyCode': 'code', 'company': 'name'}"
43 42 dcname="companyCode"
44 43 icname="code"
45   - dcname2="company"
46   - icname2="name"
47   - icnames="name"
48   - datatype="gsType"
  44 + dsparams="{{ {type: 'dic', param: 'gsType' } | json }}"
  45 + iterobjname="item"
  46 + iterobjexp="item.name"
  47 + searchph="请输拼音..."
  48 + searchexp="this.name"
49 49 required >
50   - </sa-Select3>
  50 + </sa-Select5>
51 51 </div>
52 52 <!-- 隐藏块,显示验证信息 -->
53 53 <div class="alert alert-danger well-sm" ng-show="myForm.gs.$error.required">
... ... @@ -74,15 +74,17 @@
74 74 <div class="col-md-3">
75 75 <input type="text" class="form-control"
76 76 name="jobCode" ng-model="ctrl.employeeInfoForSave.jobCode"
77   - remote-Validaton rvtype="jobCode" rv1="{{ctrl.employeeInfoForSave.companyCode}}"
78   - required placeholder="请输入工号"/>
  77 + required placeholder="请输入工号"
  78 + remote-Validation
  79 + remotevtype="ee_gh"
  80 + remotevparam="{{ {'companyCode_eq' : ctrl.employeeInfoForSave.companyCode, 'jobCode_eq': ctrl.employeeInfoForSave.jobCode} | json}}"/>
79 81 </div>
80 82 <!-- 隐藏块,显示验证信息 -->
81 83 <div class="alert alert-danger well-sm" ng-show="myForm.jobCode.$error.required">
82 84 工号必须填写
83 85 </div>
84 86 <div class="alert alert-danger well-sm" ng-show="myForm.jobCode.$error.remote">
85   - 选择公司并且相同公司工号不能重复
  87 + {{$remote_msg}}
86 88 </div>
87 89 </div>
88 90  
... ... @@ -125,15 +127,18 @@
125 127 <div class="form-group">
126 128 <label class="col-md-2 control-label">工种:</label>
127 129 <div class="col-md-4">
128   - <sa-Select3 model="ctrl.employeeInfoForSave"
129   - name="posts"
130   - placeholder="请选择工种..."
131   - dcvalue="{{ctrl.employeeInfoForSave.posts}}"
  130 + <sa-Select5 name="posts"
  131 + model="ctrl.employeeInfoForSave"
  132 + cmaps="{'posts': 'code'}"
132 133 dcname="posts"
133 134 icname="code"
134   - icnames="name"
135   - datatype="gzType">
136   - </sa-Select3>
  135 + dsparams="{{ {type: 'dic', param: 'gzType' } | json }}"
  136 + iterobjname="item"
  137 + iterobjexp="item.name"
  138 + searchph="请输拼音..."
  139 + searchexp="this.name"
  140 + >
  141 + </sa-Select5>
137 142 </div>
138 143 </div>
139 144  
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/list.html
... ... @@ -26,41 +26,46 @@
26 26 </td>
27 27 <td>
28 28 <div>
29   - <sa-Select3 model="ctrl.searchCondition()"
30   - name="gs"
31   - placeholder="请选择..."
32   - dcvalue="{{ctrl.searchCondition().companyCode_eq}}"
  29 + <sa-Select5 name="gs"
  30 + model="ctrl.searchCondition()"
  31 + cmaps="{'companyCode_eq': 'code'}"
33 32 dcname="companyCode_eq"
34 33 icname="code"
35   - icnames="name"
36   - datatype="gsType">
37   - </sa-Select3>
  34 + dsparams="{{ {type: 'dic', param: 'gsType' } | json }}"
  35 + iterobjname="item"
  36 + iterobjexp="item.name"
  37 + searchph="请输拼音..."
  38 + searchexp="this.name"
  39 + >
  40 + </sa-Select5>
38 41 </div>
39 42 </td>
40   - <td style="width: 100px">
41   -
  43 + <td>
42 44 </td>
43 45 <td>
44 46 <div>
45   - <sa-Select3 model="ctrl.searchCondition()"
46   - name="gs"
47   - placeholder="请选择..."
48   - dcvalue="{{ctrl.searchCondition().posts_eq}}"
  47 + <sa-Select5 name="gz"
  48 + model="ctrl.searchCondition()"
  49 + cmaps="{'posts_eq': 'code'}"
49 50 dcname="posts_eq"
50 51 icname="code"
51   - icnames="name"
52   - datatype="gzType">
53   - </sa-Select3>
  52 + dsparams="{{ {type: 'dic', param: 'gzType' } | json }}"
  53 + iterobjname="item"
  54 + iterobjexp="item.name"
  55 + searchph="请输拼音..."
  56 + searchexp="this.name"
  57 + >
  58 + </sa-Select5>
54 59 </div>
55 60 </td>
56 61 <td>
57 62 <div>
58 63 <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
59   - ng-click="ctrl.pageChanaged()">
  64 + ng-click="ctrl.doPage()">
60 65 <i class="fa fa-search"></i> 搜索</button>
61 66  
62 67 <button class="btn btn-sm red btn-outline filter-cancel"
63   - ng-click="ctrl.resetSearchCondition()">
  68 + ng-click="ctrl.reset()">
64 69 <i class="fa fa-times"></i> 重置</button>
65 70 </div>
66 71  
... ... @@ -69,7 +74,7 @@
69 74 </tr>
70 75 </thead>
71 76 <tbody>
72   - <tr ng-repeat="info in ctrl.pageInfo.infos" class="odd gradeX">
  77 + <tr ng-repeat="info in ctrl.page()['content']" class="odd gradeX">
73 78 <td>
74 79 <span ng-bind="$index + 1"></span>
75 80 </td>
... ... @@ -104,9 +109,9 @@
104 109  
105 110  
106 111 <div style="text-align: right;">
107   - <uib-pagination total-items="ctrl.pageInfo.totalItems"
108   - ng-model="ctrl.pageInfo.currentPage"
109   - ng-change="ctrl.pageChanaged()"
  112 + <uib-pagination total-items="ctrl.page()['totalElements']"
  113 + ng-model="ctrl.page()['uiNumber']"
  114 + ng-change="ctrl.doPage()"
110 115 rotate="false"
111 116 max-size="10"
112 117 boundary-links="true"
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/module.js
1 1 // 人员信息管理 service controller等写在一起
2 2  
3   -angular.module('ScheduleApp').factory('EmployeeInfoManageService', ['EmployeeInfoManageService_g', function(service) {
4   -
5   - /** 当前的查询条件信息 */
6   - var currentSearchCondition = {
7   - //"carCode_like" : "",
8   - //"insideCode_like" : "",
9   - //"equipmentCode_like" : "",
10   - //"carPlate_like" : ""
11   - };
  3 +angular.module('ScheduleApp').factory(
  4 + 'EmployeeInfoManageService',
  5 + [
  6 + 'EmployeeInfoManageService_g',
  7 + function(service) {
12 8  
13   - /** 当前第几页 */
14   - var currentPageNo = 1;
15   -
16   - return {
17   - /**
18   - * 获取查询条件信息,
19   - * 用于给controller用来和页面数据绑定。
20   - */
21   - getSearchCondition: function() {
22   - return currentSearchCondition;
23   - },
24   - /**
25   - * 重置查询条件信息。
26   - */
27   - resetSearchCondition: function() {
28   - var key;
29   - for (key in currentSearchCondition) {
30   - currentSearchCondition[key] = undefined;
31   - }
32   - currentPageNo = 1;
33   - },
34   - /**
35   - * 设置当前页码。
36   - * @param cpn 从1开始,后台是从0开始的
37   - */
38   - setCurrentPageNo: function(cpn) {
39   - currentPageNo = cpn;
40   - },
41   - /**
42   - * 组装查询参数,返回一个promise查询结果。
43   - * @param params 查询参数
44   - * @return 返回一个 promise
45   - */
46   - getPage: function() {
47   - var params = currentSearchCondition; // 查询条件
48   - params.page = currentPageNo - 1; // 服务端页码从0开始
49   - return service.rest.list(params).$promise;
50   - },
51   - /**
52   - * 获取明细信息。
53   - * @param id 车辆id
54   - * @return 返回一个 promise
55   - */
56   - getDetail: function(id) {
57   - var params = {id: id};
58   - return service.rest.get(params).$promise;
59   - },
60   - /**
61   - * 保存信息。
62   - * @param obj 车辆详细信息
63   - * @return 返回一个 promise
64   - */
65   - saveDetail: function(obj) {
66   - return service.rest.save(obj).$promise;
67   - },
68   - /**
69   - * 数据导出。
70   - * @returns {*|Function|promise|n}
71   - */
72   - dataExport: function() {
73   - return service.dataTools.dataExport().$promise;
74   - }
75   - }
  9 + /** 当前的查询条件信息 */
  10 + var currentSearchCondition = {
  11 + //"carCode_like" : "",
  12 + //"insideCode_like" : "",
  13 + //"equipmentCode_like" : "",
  14 + //"carPlate_like" : ""
  15 + };
76 16  
77   -}]);
  17 + // 当前查询返回的信息
  18 + var currentPage = { // 后台spring data返回的格式
  19 + totalElements: 0,
  20 + number: 0, // 后台返回的页码,spring返回从0开始
  21 + content: [],
78 22  
79   -angular.module('ScheduleApp').controller('EmployeeInfoManageCtrl', [
80   - 'EmployeeInfoManageService', '$state', '$uibModal', 'FileDownload_g',
81   - function(employeeInfoManageService, $state, $uibModal, fileDownload) {
82   - var self = this;
  23 + uiNumber: 1 // 页面绑定的页码
  24 + };
83 25  
84   - // 切换到form状态
85   - self.goForm = function() {
86   - //alert("切换");
87   - $state.go("employeeInfoManage_form");
88   - }
  26 + // 查询对象
  27 + var queryClass = service.rest;
89 28  
90   - // 导入excel
91   - self.importData = function() {
92   - // large方式弹出模态对话框
93   - var modalInstance = $uibModal.open({
94   - templateUrl: '/pages/scheduleApp/module/basicInfo/employeeInfoManage/dataImport.html',
95   - size: "lg",
96   - animation: true,
97   - backdrop: 'static',
98   - resolve: {
99   - // 可以传值给controller
  29 + return {
  30 + getQueryClass: function() {
  31 + return queryClass;
100 32 },
101   - windowClass: 'center-modal',
102   - controller: "EmployInfoManageToolsCtrl",
103   - controllerAs: "ctrl",
104   - bindToController: true
105   - });
106   - modalInstance.result.then(
107   - function() {
108   - console.log("dataImport.html打开");
  33 + /**
  34 + * 获取查询条件信息,
  35 + * 用于给controller用来和页面数据绑定。
  36 + */
  37 + getSearchCondition: function() {
  38 + currentSearchCondition.page = currentPage.uiNumber - 1;
  39 + return currentSearchCondition;
109 40 },
110   - function() {
111   - console.log("dataImport.html消失");
112   - }
113   - );
114   - };
115   -
116   - // 导出excel
117   - self.exportData = function() {
118   - employeeInfoManageService.dataExport().then(
119   - function(result) {
120   - fileDownload.downloadFile(result.data, "application/octet-stream", "人员基础信息.xls");
  41 + /**
  42 + * 组装查询参数,返回一个promise查询结果。
  43 + * @param params 查询参数
  44 + * @return 返回一个 promise
  45 + */
  46 + getPage: function(page) {
  47 + if (page) {
  48 + currentPage.totalElements = page.totalElements;
  49 + currentPage.number = page.number;
  50 + currentPage.content = page.content;
  51 + }
  52 + return currentPage;
  53 + },
  54 + resetStatus: function() {
  55 + currentSearchCondition = {page: 0};
  56 + currentPage = {
  57 + totalElements: 0,
  58 + number: 0,
  59 + content: [],
  60 + uiNumber: 1
  61 + };
121 62 },
122   - function(result) {
123   - console.log("exportData failed:" + result);
  63 +
  64 + /**
  65 + * 数据导出。
  66 + * @returns {*|Function|promise|n}
  67 + */
  68 + dataExport: function() {
  69 + return service.dataTools.dataExport().$promise;
124 70 }
125   - );
126   - };
127   - }]);
  71 + }
  72 + }
  73 + ]
  74 +);
  75 +
  76 +// index.html控制器
  77 +angular.module('ScheduleApp').controller(
  78 + 'EmployeeInfoManageCtrl',
  79 + [
  80 + 'EmployeeInfoManageService',
  81 + '$state',
  82 + '$uibModal',
  83 + 'FileDownload_g',
  84 + function(employeeInfoManageService, $state, $uibModal, fileDownload) {
  85 + var self = this;
  86 +
  87 + // 切换到form状态
  88 + self.goForm = function() {
  89 + //alert("切换");
  90 + $state.go("employeeInfoManage_form");
  91 + };
  92 +
  93 + // 导入excel
  94 + self.importData = function() {
  95 + // large方式弹出模态对话框
  96 + var modalInstance = $uibModal.open({
  97 + templateUrl: '/pages/scheduleApp/module/basicInfo/employeeInfoManage/dataImport.html',
  98 + size: "lg",
  99 + animation: true,
  100 + backdrop: 'static',
  101 + resolve: {
  102 + // 可以传值给controller
  103 + },
  104 + windowClass: 'center-modal',
  105 + controller: "EmployInfoManageToolsCtrl",
  106 + controllerAs: "ctrl",
  107 + bindToController: true
  108 + });
  109 + modalInstance.result.then(
  110 + function() {
  111 + console.log("dataImport.html打开");
  112 + },
  113 + function() {
  114 + console.log("dataImport.html消失");
  115 + }
  116 + );
  117 + };
  118 +
  119 + // 导出excel
  120 + self.exportData = function() {
  121 + employeeInfoManageService.dataExport().then(
  122 + function(result) {
  123 + fileDownload.downloadFile(result.data, "application/octet-stream", "人员基础信息.xls");
  124 + },
  125 + function(result) {
  126 + console.log("exportData failed:" + result);
  127 + }
  128 + );
  129 + };
  130 +
  131 + }
  132 + ]
  133 +);
128 134  
129 135 angular.module('ScheduleApp').controller('EmployInfoManageToolsCtrl', ['$modalInstance', 'FileUploader', function($modalInstance, FileUploader) {
130 136 var self = this;
... ... @@ -161,124 +167,101 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;EmployInfoManageToolsCtrl&#39;, [&#39;$modalIn
161 167  
162 168 }]);
163 169  
164   -angular.module('ScheduleApp').controller('EmployeeInfoManageListCtrl', ['EmployeeInfoManageService', function(employeeInfoManageService) {
165   - var self = this;
166   - self.pageInfo = {
167   - totalItems : 0,
168   - currentPage : 1,
169   - infos: []
170   - };
  170 +// list.html控制器
  171 +angular.module('ScheduleApp').controller(
  172 + 'EmployeeInfoManageListCtrl',
  173 + [
  174 + 'EmployeeInfoManageService',
  175 + function(service) {
  176 + var self = this;
  177 + var Employee = service.getQueryClass();
  178 +
  179 + self.page = function() {
  180 + return service.getPage();
  181 + };
  182 +
  183 + self.searchCondition = function() {
  184 + return service.getSearchCondition();
  185 + };
  186 +
  187 + self.doPage = function() {
  188 + var result = Employee.list(self.searchCondition(), function() {
  189 + if (!result.status) {
  190 + service.getPage(result);
  191 + }
  192 + });
  193 + };
  194 + self.reset = function() {
  195 + service.resetStatus();
  196 + var result = Employee.list(self.searchCondition(), function() {
  197 + if (!result.status) {
  198 + service.getPage(result);
  199 + }
  200 + });
  201 + };
  202 +
  203 + self.doPage();
171 204  
172   - // 初始创建的时候,获取一次列表数据
173   - employeeInfoManageService.getPage().then(
174   - function(result) {
175   - self.pageInfo.totalItems = result.totalElements;
176   - self.pageInfo.currentPage = result.number + 1;
177   - self.pageInfo.infos = result.content;
178   - employeeInfoManageService.setCurrentPageNo(result.number + 1);
179   - },
180   - function(result) {
181   - alert("出错啦!");
182 205 }
183   - );
184   -
185   - //$scope.$watch("ctrl.pageInfo.currentPage", function() {
186   - // alert("dfdfdf");
187   - //});
188   -
189   - // 翻页的时候调用
190   - self.pageChanaged = function() {
191   - employeeInfoManageService.setCurrentPageNo(self.pageInfo.currentPage);
192   - employeeInfoManageService.getPage().then(
193   - function(result) {
194   - self.pageInfo.totalItems = result.totalElements;
195   - self.pageInfo.currentPage = result.number + 1;
196   - self.pageInfo.infos = result.content;
197   - employeeInfoManageService.setCurrentPageNo(result.number + 1);
198   - },
199   - function(result) {
200   - alert("出错啦!");
201   - }
202   - );
203   - };
204   - // 获取查询条件数据
205   - self.searchCondition = function() {
206   - return employeeInfoManageService.getSearchCondition();
207   - };
208   - // 重置查询条件
209   - self.resetSearchCondition = function() {
210   - employeeInfoManageService.resetSearchCondition();
211   - self.pageInfo.currentPage = 1;
212   - self.pageChanaged();
213   - };
214   -}]);
  206 + ]
  207 +);
215 208  
216   -angular.module('ScheduleApp').controller('EmployeeInfoManageFormCtrl', ['EmployeeInfoManageService', '$stateParams', '$state', function(employeeInfoManageService, $stateParams, $state) {
217   - var self = this;
  209 +// form.html控制器
  210 +angular.module('ScheduleApp').controller(
  211 + 'EmployeeInfoManageFormCtrl',
  212 + [
  213 + 'EmployeeInfoManageService',
  214 + '$stateParams',
  215 + '$state',
  216 + function(service, $stateParams, $state) {
  217 + var self = this;
  218 + var Employee = service.getQueryClass();
218 219  
219   - // 欲保存的busInfo信息,绑定
220   - self.employeeInfoForSave = {};
221   -
222   - // 获取传过来的id,有的话就是修改,获取一遍数据
223   - var id = $stateParams.id;
224   - if (id) {
225   - self.employeeInfoForSave.id = id;
226   - employeeInfoManageService.getDetail(id).then(
227   - function(result) {
228   - var key;
229   - for (key in result) {
230   - self.employeeInfoForSave[key] = result[key];
231   - }
232   - },
233   - function(result) {
234   - alert("出错啦!");
  220 + // 欲保存的busInfo信息,绑定
  221 + self.employeeInfoForSave = new Employee;
  222 +
  223 + // 获取传过来的id,有的话就是修改,获取一遍数据
  224 + var id = $stateParams.id;
  225 + if (id) {
  226 + self.employeeInfoForSave = Employee.get({id: id}, function() {});
235 227 }
236   - );
237   - }
238   -
239   - // 提交方法
240   - self.submit = function() {
241   - console.log(self.employeeInfoForSave);
242   - employeeInfoManageService.saveDetail(self.employeeInfoForSave).then(
243   - function(result) {
244   - // TODO:弹出框方式以后改
245   - if (result.status == 'SUCCESS') {
246   - alert("保存成功!");
  228 +
  229 + // 提交方法
  230 + self.submit = function() {
  231 + console.log(self.employeeInfoForSave);
  232 +
  233 + // 保存或更新
  234 + self.employeeInfoForSave.$save(function() {
247 235 $state.go("employeeInfoManage");
248   - } else {
249   - alert("保存异常!");
250   - }
251   - },
252   - function(result) {
253   - // TODO:弹出框方式以后改
254   - alert("出错啦!");
255   - }
256   - );
257   - };
  236 + });
  237 + };
258 238  
  239 + }
  240 + ]
  241 +);
259 242  
260   -}]);
  243 +// detail.html控制器
  244 +angular.module('ScheduleApp').controller(
  245 + 'EmployeeInfoManageDetailCtrl',
  246 + [
  247 + 'EmployeeInfoManageService',
  248 + '$stateParams',
  249 + function(service, $stateParams) {
  250 + var self = this;
  251 + var Employee = service.getQueryClass();
  252 + var id = $stateParams.id;
261 253  
262   -angular.module('ScheduleApp').controller('EmployeeInfoManageDetailCtrl', ['EmployeeInfoManageService', '$stateParams', function(employeeInfoManageService, $stateParams) {
263   - var self = this;
264   - self.title = "";
265   - self.employeeInfoForDetail = {};
266   - self.employeeInfoForDetail.id = $stateParams.id;
267   -
268   - // 当转向到此页面时,就获取明细信息并绑定
269   - employeeInfoManageService.getDetail($stateParams.id).then(
270   - function(result) {
271   - var key;
272   - for (key in result) {
273   - self.employeeInfoForDetail[key] = result[key];
274   - }
  254 + self.title = "";
  255 + self.employeeInfoForDetail = {};
  256 +
  257 + // 当转向到此页面时,就获取明细信息并绑定
  258 + self.employeeInfoForDetail = Employee.get({id: id}, function() {
  259 + self.title = "员工 " +
  260 + self.employeeInfoForDetail.personnelName +
  261 + " 详细信息";
  262 + });
275 263  
276   - self.title = "员工 " + self.employeeInfoForDetail.personnelName + " 详细信息";
277   - },
278   - function(result) {
279   - // TODO:弹出框方式以后改
280   - alert("出错啦!");
281 264 }
282   - );
283   -}]);
  265 + ]
  266 +);
284 267  
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/service.js
1 1 // 人员信息service
2   -angular.module('ScheduleApp').factory('EmployeeInfoManageService_g', ['$resource', function($resource) {
3   - return {
4   - rest : $resource(
5   - '/personnel/:id',
6   - {order: 'jobCode', direction: 'ASC', id: '@id_route'},
7   - {
8   - list: {
9   - method: 'GET',
10   - params: {
11   - page: 0
  2 +angular.module('ScheduleApp').factory(
  3 + 'EmployeeInfoManageService_g',
  4 + [
  5 + '$resource',
  6 + function($resource) {
  7 + return {
  8 + rest : $resource(
  9 + '/ee/:id',
  10 + {order: 'jobCode', direction: 'ASC', id: '@id'},
  11 + {
  12 + list: {
  13 + method: 'GET',
  14 + params: {
  15 + page: 0
  16 + },
  17 + transformResponse: function(rs) {
  18 + var dst = angular.fromJson(rs);
  19 + if (dst.status == 'SUCCESS') {
  20 + return dst.data;
  21 + } else {
  22 + return dst; // 业务错误留给控制器处理
  23 + }
  24 + }
  25 + },
  26 + get: {
  27 + method: 'GET',
  28 + transformResponse: function(rs) {
  29 + var dst = angular.fromJson(rs);
  30 + if (dst.status == 'SUCCESS') {
  31 + return dst.data;
  32 + } else {
  33 + return dst;
  34 + }
  35 + }
  36 + },
  37 + save: {
  38 + method: 'POST'
  39 + }
12 40 }
13   - },
14   - get: {
15   - method: 'GET'
16   - },
17   - save: {
18   - method: 'POST'
19   - }
20   - }
21   - ),
22   - validate: $resource(
23   - '/personnel/validate/:type',
24   - {},
25   - {
26   - jobCode: {
27   - method: 'GET'
28   - }
29   - }
30   - ),
31   - dataTools: $resource(
32   - '/personnel/:type',
33   - {},
34   - {
35   - dataExport: {
36   - method: 'GET',
37   - responseType: "arraybuffer",
38   - params: {
39   - type: "dataExport"
40   - },
41   - transformResponse: function(data, headers){
42   - return {data : data};
  41 + ),
  42 +
  43 + dataTools: $resource(
  44 + '/personnel/:type',
  45 + {},
  46 + {
  47 + dataExport: {
  48 + method: 'GET',
  49 + responseType: "arraybuffer",
  50 + params: {
  51 + type: "dataExport"
  52 + },
  53 + transformResponse: function(data, headers){
  54 + return {data : data};
  55 + }
  56 + }
43 57 }
44   - }
45   - }
46   - )
47   - };
48   -}]);
  58 + )
  59 + };
  60 +
  61 + }
  62 + ]
  63 +);
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect5.js
... ... @@ -109,6 +109,10 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
109 109 // dom,span ng-bind属性设置,TODO:暂时无法用transclude设置,先用属性设置
110 110 tElem.find("ui-select-choices").html("{{" + $iterobjexp_attr + "}}");
111 111  
  112 +
  113 + // 当前的数据模式,ajax,dic,local
  114 + var dataModelType = undefined;
  115 +
112 116 return {
113 117 pre: function (scope, element, attr) {
114 118 // TODO:
... ... @@ -167,17 +171,19 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
167 171 // 处理search
168 172 console.log("search:" + search);
169 173  
170   - scope[ctrlAs].$$data = [];
171   - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
172   - var upTerm = search.toUpperCase();
173   - if (scope[ctrlAs].$$data.length < 10) {
174   - if (scope[ctrlAs].$$data_real[k].$fullChars.indexOf(upTerm) != -1
175   - || scope[ctrlAs].$$data_real[k].$camelChars.indexOf(upTerm) != -1
176   - || scope[ctrlAs].$$data_real[k].$calcu_str.indexOf(upTerm) != -1) {
177   - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  174 + if (dataModelType == 'ajax') {
  175 + scope[ctrlAs].$$data = [];
  176 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  177 + var upTerm = search.toUpperCase();
  178 + if (scope[ctrlAs].$$data.length < 10) {
  179 + if (scope[ctrlAs].$$data_real[k].$fullChars.indexOf(upTerm) != -1
  180 + || scope[ctrlAs].$$data_real[k].$camelChars.indexOf(upTerm) != -1
  181 + || scope[ctrlAs].$$data_real[k].$calcu_str.indexOf(upTerm) != -1) {
  182 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  183 + }
  184 + } else {
  185 + break;
178 186 }
179   - } else {
180   - break;
181 187 }
182 188 }
183 189 }
... ... @@ -327,16 +333,18 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
327 333  
328 334 // 重新创建内部保存的数据
329 335 scope[ctrlAs].$$data_real = [];
330   - var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
  336 + var origin_dicgroup = dictionaryUtils.getByGroup(dictype);
331 337 var dic_key; // 字典key
332 338  
  339 + //console.log(origin_dicgroup);
  340 +
333 341 for (dic_key in origin_dicgroup) {
334 342 var data = {}; // 重新组合的字典元素对象
335 343 if (dic_key == "true")
336 344 data[$icname_attr] = true;
337 345 else
338 346 data[$icname_attr] = dic_key;
339   - data[$dscol_attr] = origin_dicgroup[dic_key];
  347 + data['name'] = origin_dicgroup[dic_key]; // 字典写死name这个key名字
340 348 scope[ctrlAs].$$data_real.push(data);
341 349 }
342 350  
... ... @@ -380,11 +388,14 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
380 388 // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'}
381 389  
382 390 if (obj.type == 'dic') {
  391 + dataModelType = 'dic';
383 392 scope[ctrlAs].$$internal_dic_data(obj.param);
384 393  
385 394 } else if (obj.type == 'ajax') {
  395 + dataModelType = 'ajax';
386 396 scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
387 397 } else if (obj.type == 'local') {
  398 + dataModelType = 'local';
388 399 scope[ctrlAs].$$internal_local_data(obj.ldata);
389 400 } else {
390 401 throw new Error("dsparams参数格式异常=" + obj);
... ...
src/main/resources/static/pages/scheduleApp/module/common/main.js
... ... @@ -104,18 +104,17 @@ ScheduleApp.factory(
104 104 // 如:{"timestamp":1478674739246,"status":500,"error":"Internal Server Error","exception":"java.lang.ClassCastException","message":"java.lang.String cannot be cast to java.lang.Long","path":"/tidc/importfile"}
105 105  
106 106 var output = [];
107   - if (!status) {
  107 + if (!rejection.status) {
108 108 alert("我擦,后台返回连个状态码都没返回,见鬼了,服务器可能重启了");
109   - } else if (status == -1) {
  109 + } else if (rejection.status == -1) {
110 110 // 服务器断开了
111 111 alert("貌似服务端连接不上");
112 112 } else {
113   - output.push("状态编码:" + status);
114   - output.push("访问路径:" + rejection.path);
115   - output.push("错误消息:" + rejection.message);
116   - if (status == 500) {
  113 + output.push("状态编码:" + rejection.status);
  114 + output.push("错误内容:" + angular.toJson(rejection.data));
  115 + if (rejection.status == 500) {
117 116 alert("服务端错误:" + "\n" + output.join("\n"));
118   - } else if (status == 407) {
  117 + } else if (rejection.status == 407) {
119 118 alert("请重新登录:" + "\n" + output.join("\n"));
120 119 } else {
121 120 alert("其他错误:" + "\n" + output.join("\n"));
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
... ... @@ -59,7 +59,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [
59 59 // 判定如果参数对象不全,没有完全和模版参数里对应上,则不验证
60 60 var isParamAll = true;
61 61 for (var key in paramTemplate) {
62   - if (!$watch_rvparam_obj[key]) {
  62 + if (key != "id" && !$watch_rvparam_obj[key]) { // id去掉
63 63 isParamAll = false;
64 64 break;
65 65 }
... ... @@ -1385,6 +1385,10 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1385 1385 // dom,span ng-bind属性设置,TODO:暂时无法用transclude设置,先用属性设置
1386 1386 tElem.find("ui-select-choices").html("{{" + $iterobjexp_attr + "}}");
1387 1387  
  1388 +
  1389 + // 当前的数据模式,ajax,dic,local
  1390 + var dataModelType = undefined;
  1391 +
1388 1392 return {
1389 1393 pre: function (scope, element, attr) {
1390 1394 // TODO:
... ... @@ -1443,17 +1447,19 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1443 1447 // 处理search
1444 1448 console.log("search:" + search);
1445 1449  
1446   - scope[ctrlAs].$$data = [];
1447   - for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
1448   - var upTerm = search.toUpperCase();
1449   - if (scope[ctrlAs].$$data.length < 10) {
1450   - if (scope[ctrlAs].$$data_real[k].$fullChars.indexOf(upTerm) != -1
1451   - || scope[ctrlAs].$$data_real[k].$camelChars.indexOf(upTerm) != -1
1452   - || scope[ctrlAs].$$data_real[k].$calcu_str.indexOf(upTerm) != -1) {
1453   - scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  1450 + if (dataModelType == 'ajax') {
  1451 + scope[ctrlAs].$$data = [];
  1452 + for (var k = 0; k < scope[ctrlAs].$$data_real.length; k++) {
  1453 + var upTerm = search.toUpperCase();
  1454 + if (scope[ctrlAs].$$data.length < 10) {
  1455 + if (scope[ctrlAs].$$data_real[k].$fullChars.indexOf(upTerm) != -1
  1456 + || scope[ctrlAs].$$data_real[k].$camelChars.indexOf(upTerm) != -1
  1457 + || scope[ctrlAs].$$data_real[k].$calcu_str.indexOf(upTerm) != -1) {
  1458 + scope[ctrlAs].$$data.push(angular.copy(scope[ctrlAs].$$data_real[k]));
  1459 + }
  1460 + } else {
  1461 + break;
1454 1462 }
1455   - } else {
1456   - break;
1457 1463 }
1458 1464 }
1459 1465 }
... ... @@ -1603,16 +1609,18 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1603 1609  
1604 1610 // 重新创建内部保存的数据
1605 1611 scope[ctrlAs].$$data_real = [];
1606   - var origin_dicgroup = dictionaryUtils.getByGroup(dicgroup);
  1612 + var origin_dicgroup = dictionaryUtils.getByGroup(dictype);
1607 1613 var dic_key; // 字典key
1608 1614  
  1615 + //console.log(origin_dicgroup);
  1616 +
1609 1617 for (dic_key in origin_dicgroup) {
1610 1618 var data = {}; // 重新组合的字典元素对象
1611 1619 if (dic_key == "true")
1612 1620 data[$icname_attr] = true;
1613 1621 else
1614 1622 data[$icname_attr] = dic_key;
1615   - data[$dscol_attr] = origin_dicgroup[dic_key];
  1623 + data['name'] = origin_dicgroup[dic_key]; // 字典写死name这个key名字
1616 1624 scope[ctrlAs].$$data_real.push(data);
1617 1625 }
1618 1626  
... ... @@ -1656,11 +1664,14 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1656 1664 // {type: 'dic/ajax', param: 'dic名字'/'ajax查询参数对象', atype: 'ajax查询类型'}
1657 1665  
1658 1666 if (obj.type == 'dic') {
  1667 + dataModelType = 'dic';
1659 1668 scope[ctrlAs].$$internal_dic_data(obj.param);
1660 1669  
1661 1670 } else if (obj.type == 'ajax') {
  1671 + dataModelType = 'ajax';
1662 1672 scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
1663 1673 } else if (obj.type == 'local') {
  1674 + dataModelType = 'local';
1664 1675 scope[ctrlAs].$$internal_local_data(obj.ldata);
1665 1676 } else {
1666 1677 throw new Error("dsparams参数格式异常=" + obj);
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice-legacy.js
... ... @@ -263,7 +263,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;$$SearchInfoService_g&#39;, [&#39;$resource&#39;, fun
263 263 gbv1: { // 路牌序号验证
264 264 template: {'xl.id_eq': -1, 'lpNo_eq': 'ddd'},
265 265 remote: $resource(
266   - '/gic/validate1',
  266 + '/gic/validate_lpno',
267 267 {},
268 268 {
269 269 do: {
... ... @@ -275,7 +275,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;$$SearchInfoService_g&#39;, [&#39;$resource&#39;, fun
275 275 gbv2: { // 路牌名称验证
276 276 template: {'xl.id_eq': -1, 'lpName_eq': 'ddd'},
277 277 remote: $resource(
278   - '/gic/validate2',
  278 + '/gic/validate_lpname',
279 279 {},
280 280 {
281 281 do: {
... ... @@ -336,6 +336,20 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;$$SearchInfoService_g&#39;, [&#39;$resource&#39;, fun
336 336 }
337 337 )
338 338 },
  339 +
  340 + ee_gh: { // 工号不能重复
  341 + template: {'companyCode_eq': '-1', 'jobCode_eq': '-1'}, // 查询参数模版
  342 + remote: $resource( // $resource封装对象
  343 + '/ee/validate_gh',
  344 + {},
  345 + {
  346 + do: {
  347 + method: 'GET'
  348 + }
  349 + }
  350 + )
  351 + },
  352 +
339 353 cc_cars: { // 车辆不能重复配置
340 354 template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'cl.id_eq': -1}, // 查询参数模版
341 355 remote: $resource( // $resource封装对象
... ... @@ -374,9 +388,9 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;$$SearchInfoService_g&#39;, [&#39;$resource&#39;, fun
374 388 },
375 389  
376 390 cde1: { // 车辆设备启用日期验证
377   - template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒
  391 + template: {'xl_eq': -1, 'cl_eq': -1, 'qyrq_eq': 1}, // 日期毫秒
378 392 remote: $resource( // $resource封装对象
379   - '/cde//validate/qyrq',
  393 + '/cde_sc/validate_qyrq',
380 394 {},
381 395 {
382 396 do: {
... ...