Commit 8e5d681a585a7a16d18711065bc4d1947eba90cc
1 parent
11f520fd
PSM-15
Showing
7 changed files
with
191 additions
and
34 deletions
src/main/java/com/bsth/entity/schedule/EmployeeConfigInfo.java
| @@ -4,6 +4,7 @@ import com.bsth.entity.Cars; | @@ -4,6 +4,7 @@ import com.bsth.entity.Cars; | ||
| 4 | import com.bsth.entity.Line; | 4 | import com.bsth.entity.Line; |
| 5 | import com.bsth.entity.Personnel; | 5 | import com.bsth.entity.Personnel; |
| 6 | import com.bsth.entity.sys.SysUser; | 6 | import com.bsth.entity.sys.SysUser; |
| 7 | +import org.hibernate.annotations.Formula; | ||
| 7 | 8 | ||
| 8 | import javax.persistence.*; | 9 | import javax.persistence.*; |
| 9 | import javax.validation.constraints.NotNull; | 10 | import javax.validation.constraints.NotNull; |
| @@ -45,6 +46,13 @@ public class EmployeeConfigInfo { | @@ -45,6 +46,13 @@ public class EmployeeConfigInfo { | ||
| 45 | @NotNull | 46 | @NotNull |
| 46 | private String dbbm; | 47 | private String dbbm; |
| 47 | 48 | ||
| 49 | + @Formula(" dbbm + 0 ") | ||
| 50 | + private Integer dbbmFormula; | ||
| 51 | + | ||
| 52 | + /** 是否删除(标记) */ | ||
| 53 | + @Column(nullable = false) | ||
| 54 | + private Boolean isCancel = false; | ||
| 55 | + | ||
| 48 | /** 创建人 */ | 56 | /** 创建人 */ |
| 49 | @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) | 57 | @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) |
| 50 | private SysUser createBy; | 58 | private SysUser createBy; |
| @@ -122,4 +130,36 @@ public class EmployeeConfigInfo { | @@ -122,4 +130,36 @@ public class EmployeeConfigInfo { | ||
| 122 | public void setUpdateDate(Date updateDate) { | 130 | public void setUpdateDate(Date updateDate) { |
| 123 | this.updateDate = updateDate; | 131 | this.updateDate = updateDate; |
| 124 | } | 132 | } |
| 133 | + | ||
| 134 | + public Integer getDbbmFormula() { | ||
| 135 | + return dbbmFormula; | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + public void setDbbmFormula(Integer dbbmFormula) { | ||
| 139 | + this.dbbmFormula = dbbmFormula; | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + public SysUser getCreateBy() { | ||
| 143 | + return createBy; | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + public void setCreateBy(SysUser createBy) { | ||
| 147 | + this.createBy = createBy; | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + public SysUser getUpdateBy() { | ||
| 151 | + return updateBy; | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + public void setUpdateBy(SysUser updateBy) { | ||
| 155 | + this.updateBy = updateBy; | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + public Boolean getIsCancel() { | ||
| 159 | + return isCancel; | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + public void setIsCancel(Boolean isCancel) { | ||
| 163 | + this.isCancel = isCancel; | ||
| 164 | + } | ||
| 125 | } | 165 | } |
src/main/java/com/bsth/entity/search/CustomerSpecs.java
| 1 | package com.bsth.entity.search; | 1 | package com.bsth.entity.search; |
| 2 | 2 | ||
| 3 | -import java.lang.reflect.Method; | ||
| 4 | -import java.util.ArrayList; | ||
| 5 | -import java.util.List; | ||
| 6 | -import java.util.Map; | ||
| 7 | -import java.util.Set; | ||
| 8 | -import java.util.TreeSet; | ||
| 9 | - | ||
| 10 | -import javax.persistence.criteria.CriteriaBuilder; | ||
| 11 | -import javax.persistence.criteria.CriteriaQuery; | ||
| 12 | -import javax.persistence.criteria.Path; | ||
| 13 | -import javax.persistence.criteria.Predicate; | ||
| 14 | -import javax.persistence.criteria.Root; | ||
| 15 | - | 3 | +import com.bsth.entity.search.exception.UnrecognizableSearchSymbolException; |
| 16 | import org.apache.commons.lang3.StringUtils; | 4 | import org.apache.commons.lang3.StringUtils; |
| 17 | import org.slf4j.Logger; | 5 | import org.slf4j.Logger; |
| 18 | import org.slf4j.LoggerFactory; | 6 | import org.slf4j.LoggerFactory; |
| 19 | import org.springframework.data.jpa.domain.Specification; | 7 | import org.springframework.data.jpa.domain.Specification; |
| 20 | 8 | ||
| 21 | -import com.bsth.entity.search.exception.UnrecognizableSearchSymbolException; | 9 | +import javax.persistence.criteria.*; |
| 10 | +import java.lang.reflect.Method; | ||
| 11 | +import java.util.*; | ||
| 22 | 12 | ||
| 23 | /** | 13 | /** |
| 24 | * | 14 | * |
| @@ -74,6 +64,14 @@ public class CustomerSpecs<T> implements Specification<T> { | @@ -74,6 +64,14 @@ public class CustomerSpecs<T> implements Specification<T> { | ||
| 74 | // 值为空的不参与查询 | 64 | // 值为空的不参与查询 |
| 75 | if (value == null || (value instanceof String && value.equals(""))) | 65 | if (value == null || (value instanceof String && value.equals(""))) |
| 76 | continue; | 66 | continue; |
| 67 | + | ||
| 68 | + // 如果是布尔值,转换,限定 'true','false' 字符串 | ||
| 69 | + if ("true".equals(value)) { | ||
| 70 | + value = Boolean.TRUE; | ||
| 71 | + } | ||
| 72 | + if ("false".equals(value)) { | ||
| 73 | + value = Boolean.FALSE; | ||
| 74 | + } | ||
| 77 | 75 | ||
| 78 | try { | 76 | try { |
| 79 | if(!eSet.contains(searchs[1])) | 77 | if(!eSet.contains(searchs[1])) |
src/main/java/com/bsth/service/schedule/EmployeeConfigInfoServiceImpl.java
| 1 | package com.bsth.service.schedule; | 1 | package com.bsth.service.schedule; |
| 2 | 2 | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.entity.Line; | ||
| 3 | import com.bsth.entity.schedule.EmployeeConfigInfo; | 5 | import com.bsth.entity.schedule.EmployeeConfigInfo; |
| 6 | +import com.bsth.entity.schedule.rule.ScheduleRule1Flat; | ||
| 7 | +import com.bsth.repository.schedule.EmployeeConfigInfoRepository; | ||
| 4 | import com.bsth.service.impl.BaseServiceImpl; | 8 | import com.bsth.service.impl.BaseServiceImpl; |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 5 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
| 6 | 11 | ||
| 12 | +import javax.transaction.Transactional; | ||
| 13 | +import java.util.*; | ||
| 14 | + | ||
| 7 | /** | 15 | /** |
| 8 | * Created by xu on 16/5/10. | 16 | * Created by xu on 16/5/10. |
| 9 | */ | 17 | */ |
| 10 | @Service | 18 | @Service |
| 11 | public class EmployeeConfigInfoServiceImpl extends BaseServiceImpl<EmployeeConfigInfo, Long> implements EmployeeConfigInfoService { | 19 | public class EmployeeConfigInfoServiceImpl extends BaseServiceImpl<EmployeeConfigInfo, Long> implements EmployeeConfigInfoService { |
| 20 | + @Autowired | ||
| 21 | + private EmployeeConfigInfoRepository employeeConfigInfoRepository; | ||
| 22 | + @Autowired | ||
| 23 | + private ScheduleRule1FlatService scheduleRule1FlatService; | ||
| 24 | + | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + @Transactional | ||
| 28 | + public Map<String, Object> delete(Long aLong) { | ||
| 29 | + // 获取待作废的人员配置 | ||
| 30 | + EmployeeConfigInfo employeeConfigInfo = employeeConfigInfoRepository.findOne(aLong); | ||
| 31 | + // 获取线路 | ||
| 32 | + Line xl = employeeConfigInfo.getXl(); | ||
| 33 | + // 查找线路的规则,比较人员配置信息 | ||
| 34 | + Map<String, Object> param = new HashMap<>(); | ||
| 35 | + param.put("xl.id_eq", xl.getId()); | ||
| 36 | + Iterator<ScheduleRule1Flat> employeeConfigInfoIterator = scheduleRule1FlatService.list(param).iterator(); | ||
| 37 | + List<String> ryConfigIds = new ArrayList<>(); | ||
| 38 | + while (employeeConfigInfoIterator.hasNext()) { | ||
| 39 | + ScheduleRule1Flat scheduleRule1Flat = employeeConfigInfoIterator.next(); | ||
| 40 | + ryConfigIds.addAll(Arrays.asList(scheduleRule1Flat.getRyConfigIds().split(","))); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + Map<String, Object> map = new HashMap<>(); | ||
| 44 | + | ||
| 45 | + if (ryConfigIds.contains(employeeConfigInfo.getId().toString())) { | ||
| 46 | + throw new RuntimeException("人员配置已被规则使用,不能删除,请先修改规则!"); | ||
| 47 | + } else { | ||
| 48 | + employeeConfigInfo.setIsCancel(true); | ||
| 49 | + map.put("status", ResponseCode.SUCCESS); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + return map; | ||
| 53 | + } | ||
| 54 | + | ||
| 12 | } | 55 | } |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
| @@ -2362,7 +2362,7 @@ angular.module('ScheduleApp').directive('saEmployeegroup', [ | @@ -2362,7 +2362,7 @@ angular.module('ScheduleApp').directive('saEmployeegroup', [ | ||
| 2362 | console.log("xlidvalue=" + value); | 2362 | console.log("xlidvalue=" + value); |
| 2363 | 2363 | ||
| 2364 | employeeConfigService_g.rest.list( | 2364 | employeeConfigService_g.rest.list( |
| 2365 | - {"xl.id_eq": value, size: 100}, | 2365 | + {"xl.id_eq": value, "isCancel_eq" : false, size: 100}, |
| 2366 | function(result) { | 2366 | function(result) { |
| 2367 | // 获取值了 | 2367 | // 获取值了 |
| 2368 | console.log("人员配置获取了"); | 2368 | console.log("人员配置获取了"); |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
| @@ -222,7 +222,7 @@ angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', f | @@ -222,7 +222,7 @@ angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', f | ||
| 222 | return { | 222 | return { |
| 223 | rest : $resource( | 223 | rest : $resource( |
| 224 | '/eci/:id', | 224 | '/eci/:id', |
| 225 | - {order: 'createDate', direction: 'ASC', id: '@id_route'}, | 225 | + {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id_route'}, |
| 226 | { | 226 | { |
| 227 | list: { | 227 | list: { |
| 228 | method: 'GET', | 228 | method: 'GET', |
| @@ -235,6 +235,9 @@ angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', f | @@ -235,6 +235,9 @@ angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', f | ||
| 235 | }, | 235 | }, |
| 236 | save: { | 236 | save: { |
| 237 | method: 'POST' | 237 | method: 'POST' |
| 238 | + }, | ||
| 239 | + delete: { | ||
| 240 | + method: 'DELETE' | ||
| 238 | } | 241 | } |
| 239 | } | 242 | } |
| 240 | ), | 243 | ), |
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/employeeConfig.js
| @@ -57,6 +57,14 @@ angular.module('ScheduleApp').factory('EmployeeConfigService', ['EmployeeConfigS | @@ -57,6 +57,14 @@ angular.module('ScheduleApp').factory('EmployeeConfigService', ['EmployeeConfigS | ||
| 57 | */ | 57 | */ |
| 58 | saveDetail: function(obj) { | 58 | saveDetail: function(obj) { |
| 59 | return service.rest.save(obj).$promise; | 59 | return service.rest.save(obj).$promise; |
| 60 | + }, | ||
| 61 | + /** | ||
| 62 | + * 删除信息。 | ||
| 63 | + * @param id 主键id | ||
| 64 | + * @returns {*|Function|promise|n} | ||
| 65 | + */ | ||
| 66 | + deleteDetail: function(id) { | ||
| 67 | + return service.rest.delete({id: id}).$promise; | ||
| 60 | } | 68 | } |
| 61 | }; | 69 | }; |
| 62 | }]); | 70 | }]); |
| @@ -183,6 +191,75 @@ angular.module('ScheduleApp').controller('EmployeeConfigListCtrl', ['EmployeeCon | @@ -183,6 +191,75 @@ angular.module('ScheduleApp').controller('EmployeeConfigListCtrl', ['EmployeeCon | ||
| 183 | self.pageInfo.currentPage = 1; | 191 | self.pageInfo.currentPage = 1; |
| 184 | self.pageChanaged(); | 192 | self.pageChanaged(); |
| 185 | }; | 193 | }; |
| 194 | + | ||
| 195 | + // 删除时刻表 | ||
| 196 | + self.deleteEci = function(id) { | ||
| 197 | + // TODO: | ||
| 198 | + employeeConfigService.deleteDetail(id).then( | ||
| 199 | + function(result) { | ||
| 200 | + if (result.message) { // 暂时这样做,之后全局拦截 | ||
| 201 | + alert("失败:" + result.message); | ||
| 202 | + } else { | ||
| 203 | + alert("作废成功!"); | ||
| 204 | + | ||
| 205 | + employeeConfigService.getPage().then( | ||
| 206 | + function(result) { | ||
| 207 | + self.pageInfo.totalItems = result.totalElements; | ||
| 208 | + self.pageInfo.currentPage = result.number + 1; | ||
| 209 | + self.pageInfo.infos = result.content; | ||
| 210 | + employeeConfigService.setCurrentPageNo(result.number + 1); | ||
| 211 | + }, | ||
| 212 | + function(result) { | ||
| 213 | + alert("出错啦!"); | ||
| 214 | + } | ||
| 215 | + ); | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + }, | ||
| 219 | + function(result) { | ||
| 220 | + alert("出错啦!" + result); | ||
| 221 | + } | ||
| 222 | + ); | ||
| 223 | + }; | ||
| 224 | + | ||
| 225 | + // 撤销修改 | ||
| 226 | + self.redoDeleteEci = function(id) { | ||
| 227 | + employeeConfigService.getDetail(id).then( | ||
| 228 | + function(result) { | ||
| 229 | + result.isCancel = 'false'; | ||
| 230 | + employeeConfigService.saveDetail(result).then( | ||
| 231 | + function(result) { | ||
| 232 | + if (result.message) { // 暂时这样做,之后全局拦截 | ||
| 233 | + alert("失败:" + result.message); | ||
| 234 | + } else { | ||
| 235 | + alert("撤销成功!"); | ||
| 236 | + | ||
| 237 | + employeeConfigService.getPage().then( | ||
| 238 | + function(result) { | ||
| 239 | + self.pageInfo.totalItems = result.totalElements; | ||
| 240 | + self.pageInfo.currentPage = result.number + 1; | ||
| 241 | + self.pageInfo.infos = result.content; | ||
| 242 | + employeeConfigService.setCurrentPageNo(result.number + 1); | ||
| 243 | + }, | ||
| 244 | + function(result) { | ||
| 245 | + alert("出错啦!"); | ||
| 246 | + } | ||
| 247 | + ); | ||
| 248 | + } | ||
| 249 | + }, | ||
| 250 | + function(result) { | ||
| 251 | + // TODO:弹出框方式以后改 | ||
| 252 | + alert("出错啦!"); | ||
| 253 | + } | ||
| 254 | + ); | ||
| 255 | + }, | ||
| 256 | + function(result) { | ||
| 257 | + // TODO:弹出框方式以后改 | ||
| 258 | + alert("出错啦!"); | ||
| 259 | + } | ||
| 260 | + ); | ||
| 261 | + }; | ||
| 262 | + | ||
| 186 | }]); | 263 | }]); |
| 187 | 264 | ||
| 188 | angular.module('ScheduleApp').controller('EmployeeConfigFormCtrl', ['EmployeeConfigService', '$stateParams', '$state', function(employeeConfigService, $stateParams, $state) { | 265 | angular.module('ScheduleApp').controller('EmployeeConfigFormCtrl', ['EmployeeConfigService', '$stateParams', '$state', function(employeeConfigService, $stateParams, $state) { |
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/list.html
| @@ -31,24 +31,18 @@ | @@ -31,24 +31,18 @@ | ||
| 31 | </div> | 31 | </div> |
| 32 | </td> | 32 | </td> |
| 33 | <td></td> | 33 | <td></td> |
| 34 | - <td></td> | ||
| 35 | <td> | 34 | <td> |
| 36 | - <div> | ||
| 37 | - <sa-Select3 model="ctrl.searchCondition()" | ||
| 38 | - name="ry" | ||
| 39 | - placeholder="请输拼音..." | ||
| 40 | - dcvalue="{{ctrl.searchCondition()['jsy.id_eq']}}" | ||
| 41 | - dcname="jsy.id_eq" | ||
| 42 | - icname="id" | ||
| 43 | - icnames="personnelName" | ||
| 44 | - datatype="ry" | ||
| 45 | - dataassociate="true" | ||
| 46 | - dataparam="{{ {'companyCode_eq': ctrl.searchCondition()['xl.company_eq']} | json }}" > | ||
| 47 | - </sa-Select3> | ||
| 48 | - </div> | 35 | + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition()['jsy.jobCode_like']" placeholder="输入工号..."/> |
| 36 | + </td> | ||
| 37 | + <td> | ||
| 38 | + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition()['jsy.personnelName_like']" placeholder="输入姓名..."/> | ||
| 39 | + </td> | ||
| 40 | + <td> | ||
| 41 | + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition()['spy.jobCode_like']" placeholder="输入工号..."/> | ||
| 42 | + </td> | ||
| 43 | + <td> | ||
| 44 | + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition()['spy.personnelName_like']" placeholder="输入姓名..."/> | ||
| 49 | </td> | 45 | </td> |
| 50 | - <td></td> | ||
| 51 | - <td></td> | ||
| 52 | <td> | 46 | <td> |
| 53 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" | 47 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" |
| 54 | ng-click="ctrl.pageChanaged()"> | 48 | ng-click="ctrl.pageChanaged()"> |
| @@ -63,7 +57,7 @@ | @@ -63,7 +57,7 @@ | ||
| 63 | 57 | ||
| 64 | </thead> | 58 | </thead> |
| 65 | <tbody> | 59 | <tbody> |
| 66 | - <tr ng-repeat="info in ctrl.pageInfo.infos" class="odd gradeX"> | 60 | + <tr ng-repeat="info in ctrl.pageInfo.infos" ng-class="{odd: true, gradeX: true, danger: info.isCancel}"> |
| 67 | <td> | 61 | <td> |
| 68 | <span ng-bind="$index + 1"></span> | 62 | <span ng-bind="$index + 1"></span> |
| 69 | </td> | 63 | </td> |
| @@ -89,7 +83,9 @@ | @@ -89,7 +83,9 @@ | ||
| 89 | <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> | 83 | <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> |
| 90 | <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>--> | 84 | <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>--> |
| 91 | <a ui-sref="employeeConfig_detail({id: info.id})" class="btn default blue-stripe btn-sm"> 详细 </a> | 85 | <a ui-sref="employeeConfig_detail({id: info.id})" class="btn default blue-stripe btn-sm"> 详细 </a> |
| 92 | - <a ui-sref="employeeConfig_edit({id: info.id})" class="btn default blue-stripe btn-sm"> 修改 </a> | 86 | + <a ui-sref="employeeConfig_edit({id: info.id})" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '0'"> 修改 </a> |
| 87 | + <a ng-click="ctrl.deleteEci(info.id)" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '0'"> 作废 </a> | ||
| 88 | + <a ng-click="ctrl.redoDeleteEci(info.id)" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a> | ||
| 93 | </td> | 89 | </td> |
| 94 | </tr> | 90 | </tr> |
| 95 | </tbody> | 91 | </tbody> |