Commit 878dd61442d761f1f03dfce030a30aeb9a007257

Authored by 徐烜
1 parent 4a0cb023

Update

src/main/java/com/bsth/controller/schedule/core/GuideboardInfoController.java
... ... @@ -48,8 +48,8 @@ public class GuideboardInfoController extends BController<GuideboardInfo, Long>
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/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/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/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/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: {
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
... ... @@ -295,7 +295,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;GuideboardManageService_g&#39;, [&#39;$resource&#39;,
295 295 return {
296 296 rest: $resource(
297 297 '/gic/:id',
298   - {order: 'xl,isCancel', direction: 'DESC,ASC', id: '@id_route'},
  298 + {order: 'xl,isCancel', direction: 'DESC,ASC', id: '@id'},
299 299 {
300 300 list: {
301 301 method: 'GET',
... ... @@ -817,7 +817,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;$$SearchInfoService_g&#39;, [&#39;$resource&#39;, fun
817 817 gbv1: { // 路牌序号验证
818 818 template: {'xl.id_eq': -1, 'lpNo_eq': 'ddd'},
819 819 remote: $resource(
820   - '/gic/validate1',
  820 + '/gic/validate_lpno',
821 821 {},
822 822 {
823 823 do: {
... ... @@ -829,7 +829,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;$$SearchInfoService_g&#39;, [&#39;$resource&#39;, fun
829 829 gbv2: { // 路牌名称验证
830 830 template: {'xl.id_eq': -1, 'lpName_eq': 'ddd'},
831 831 remote: $resource(
832   - '/gic/validate2',
  832 + '/gic/validate_lpname',
833 833 {},
834 834 {
835 835 do: {
... ...
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/form.html
... ... @@ -63,7 +63,7 @@
63 63 name="lpNo" placeholder="请输入路牌编号..." min="1" required
64 64 remote-Validation
65 65 remotevtype="gbv1"
66   - remotevparam="{{ {'id_eq': ctrl.guideboardManageForForm.id, 'xl.id_eq': ctrl.guideboardManageForForm.xl.id, 'lpNo_eq': ctrl.guideboardManageForForm.lpNo} | json}}"
  66 + remotevparam="{{ {'xl.id_eq': ctrl.guideboardManageForForm.xl.id, 'lpNo_eq': ctrl.guideboardManageForForm.lpNo} | json}}"
67 67  
68 68 />
69 69 </div>
... ... @@ -85,7 +85,7 @@
85 85 name="lpName" placeholder="请输入路牌名字..." required
86 86 remote-Validation
87 87 remotevtype="gbv2"
88   - remotevparam="{{ {'id_eq': ctrl.guideboardManageForForm.id, 'xl.id_eq': ctrl.guideboardManageForForm.xl.id, 'lpName_eq': ctrl.guideboardManageForForm.lpName} | json}}"
  88 + remotevparam="{{ {'xl.id_eq': ctrl.guideboardManageForForm.xl.id, 'lpName_eq': ctrl.guideboardManageForForm.lpName} | json}}"
89 89  
90 90 />
91 91 </div>
... ...
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/list.html
... ... @@ -77,8 +77,8 @@
77 77 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
78 78 <a ui-sref="guideboardManage_detail({id : info.id})" class="btn btn-info btn-sm"> 详细 </a>
79 79 <a ui-sref="guideboardManage_edit({id: info.id})" class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 修改 </a>
80   - <a ng-click="ctrl.toggleCancel(info.id)" class="btn btn-danger btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
81   - <a ng-click="ctrl.toggleCancel(info.id)" class="btn btn-success btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
  80 + <a ng-click="ctrl.toggleGuideboard(info.id)" class="btn btn-danger btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
  81 + <a ng-click="ctrl.toggleGuideboard(info.id)" class="btn btn-success btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
82 82 </td>
83 83 </tr>
84 84 </tbody>
... ...
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/module.js
... ... @@ -180,18 +180,8 @@ angular.module(&#39;ScheduleApp&#39;).controller(
180 180 service.getPage(result);
181 181 });
182 182 };
183   - self.toggleTtinfo = function(id) {
184   - Gb.delete({id: id}, function(result) {
185   - if (result.message) { // 暂时这样做,之后全局拦截
186   - alert("失败:" + result.message);
187   - } else {
188   - self.doPage();
189   - }
190   - });
191   - };
192   -
193 183 // 作废切换
194   - self.toggleCancel = function(id) {
  184 + self.toggleGuideboard = function(id) {
195 185 Gb.delete({id: id}, function(result) {
196 186 if (result.status == "ERROR") { // 暂时这样做,之后全局拦截
197 187 alert("失败:" + result.msg);
... ...
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/service.js
... ... @@ -3,7 +3,7 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;GuideboardManageService_g&#39;, [&#39;$resource&#39;,
3 3 return {
4 4 rest: $resource(
5 5 '/gic/:id',
6   - {order: 'xl,isCancel', direction: 'DESC,ASC', id: '@id_route'},
  6 + {order: 'xl,isCancel', direction: 'DESC,ASC', id: '@id'},
7 7 {
8 8 list: {
9 9 method: 'GET',
... ...