Commit f386d7bf11064907dec0c42eaf4891450b8a4002

Authored by 潘钊
2 parents ec1ef1a5 ba862df1

Merge branch 'master' of 192.168.168.201:panzhaov5/bsth_control

Showing 30 changed files with 1966 additions and 66 deletions
@@ -98,7 +98,39 @@ @@ -98,7 +98,39 @@
98 <artifactId>guava</artifactId> 98 <artifactId>guava</artifactId>
99 <version>19.0</version> 99 <version>19.0</version>
100 </dependency> 100 </dependency>
  101 +
  102 + <!-- drools 6依赖 -->
  103 + <dependency>
  104 + <groupId>org.kie</groupId>
  105 + <artifactId>kie-api</artifactId>
  106 + </dependency>
  107 + <dependency>
  108 + <groupId>org.drools</groupId>
  109 + <artifactId>drools-compiler</artifactId>
  110 + </dependency>
  111 +
  112 + <!-- springboot测试 -->
  113 + <dependency>
  114 + <groupId>org.springframework.boot</groupId>
  115 + <artifactId>spring-boot-starter-test</artifactId>
  116 + <scope>test</scope>
  117 + </dependency>
  118 +
101 </dependencies> 119 </dependencies>
  120 +
  121 + <dependencyManagement>
  122 + <dependencies>
  123 + <!-- drools 6依赖 -->
  124 + <dependency>
  125 + <groupId>org.drools</groupId>
  126 + <artifactId>drools-bom</artifactId>
  127 + <type>pom</type>
  128 + <version>6.2.0.Final</version>
  129 + <scope>import</scope>
  130 + </dependency>
  131 + </dependencies>
  132 + </dependencyManagement>
  133 +
102 <build> 134 <build>
103 <plugins> 135 <plugins>
104 <plugin> 136 <plugin>
src/main/java/com/bsth/controller/CarDeviceController.java 0 → 100644
  1 +package com.bsth.controller;
  2 +
  3 +import com.bsth.entity.CarDevice;
  4 +import org.springframework.web.bind.annotation.RequestBody;
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +import org.springframework.web.bind.annotation.RequestMethod;
  7 +import org.springframework.web.bind.annotation.RestController;
  8 +
  9 +import java.util.Map;
  10 +
  11 +/**
  12 + * Created by xu on 16/6/15.
  13 + */
  14 +@RestController
  15 +@RequestMapping("carDevice")
  16 +public class CarDeviceController extends BaseController<CarDevice, Long> {
  17 +
  18 + /**
  19 + * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody
  20 + * @Title: save
  21 + * @Description: TODO(持久化对象)
  22 + * @param @param t
  23 + * @param @return 设定文件
  24 + * @return Map<String,Object> {status: 1(成功),-1(失败)}
  25 + * @throws
  26 + */
  27 + @RequestMapping(method = RequestMethod.POST)
  28 + public Map<String, Object> save(@RequestBody CarDevice t){
  29 + return baseService.save(t);
  30 + }
  31 +}
src/main/java/com/bsth/controller/PersonnelController.java 0 → 100644
  1 +package com.bsth.controller;
  2 +
  3 +import com.bsth.entity.Personnel;
  4 +import org.springframework.web.bind.annotation.RequestBody;
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +import org.springframework.web.bind.annotation.RequestMethod;
  7 +import org.springframework.web.bind.annotation.RestController;
  8 +
  9 +import java.util.Map;
  10 +
  11 +/**
  12 + * Created by xu on 16/6/15.
  13 + */
  14 +@RestController
  15 +@RequestMapping("personnel")
  16 +public class PersonnelController extends BaseController<Personnel, Integer> {
  17 + /**
  18 + * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody
  19 + * @Title: save
  20 + * @Description: TODO(持久化对象)
  21 + * @param @param t
  22 + * @param @return 设定文件
  23 + * @return Map<String,Object> {status: 1(成功),-1(失败)}
  24 + * @throws
  25 + */
  26 + @RequestMapping(method = RequestMethod.POST)
  27 + public Map<String, Object> save(@RequestBody Personnel t){
  28 + return baseService.save(t);
  29 + }
  30 +}
src/main/java/com/bsth/repository/CarDeviceRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import com.bsth.entity.CarDevice;
  4 +import org.springframework.stereotype.Repository;
  5 +
  6 +/**
  7 + * Created by xu on 16/6/15.
  8 + */
  9 +@Repository
  10 +public interface CarDeviceRepository extends BaseRepository<CarDevice, Long> {
  11 +}
src/main/java/com/bsth/repository/PersonnelRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import com.bsth.entity.Personnel;
  4 +import org.springframework.stereotype.Repository;
  5 +
  6 +/**
  7 + * Created by xu on 16/6/15.
  8 + */
  9 +@Repository
  10 +public interface PersonnelRepository extends BaseRepository<Personnel, Integer> {
  11 +}
src/main/java/com/bsth/service/CarDeviceService.java 0 → 100644
  1 +package com.bsth.service;
  2 +
  3 +import com.bsth.entity.CarDevice;
  4 +
  5 +/**
  6 + * Created by xu on 16/6/15.
  7 + */
  8 +public interface CarDeviceService extends BaseService<CarDevice, Long> {
  9 +}
src/main/java/com/bsth/service/PersonnelService.java 0 → 100644
  1 +package com.bsth.service;
  2 +
  3 +import com.bsth.entity.Personnel;
  4 +
  5 +/**
  6 + * Created by xu on 16/6/15.
  7 + */
  8 +public interface PersonnelService extends BaseService<Personnel, Integer> {
  9 +}
src/main/java/com/bsth/service/impl/CarDeviceServiceImpl.java 0 → 100644
  1 +package com.bsth.service.impl;
  2 +
  3 +import com.bsth.entity.CarDevice;
  4 +import com.bsth.service.CarDeviceService;
  5 +import org.springframework.stereotype.Service;
  6 +
  7 +/**
  8 + * Created by xu on 16/6/15.
  9 + */
  10 +@Service
  11 +public class CarDeviceServiceImpl extends BaseServiceImpl<CarDevice, Long> implements CarDeviceService {
  12 +}
src/main/java/com/bsth/service/impl/PersonnelServiceImpl.java 0 → 100644
  1 +package com.bsth.service.impl;
  2 +
  3 +import com.bsth.entity.Personnel;
  4 +import com.bsth.service.PersonnelService;
  5 +import org.springframework.stereotype.Service;
  6 +
  7 +/**
  8 + * Created by xu on 16/6/15.
  9 + */
  10 +@Service
  11 +public class PersonnelServiceImpl extends BaseServiceImpl<Personnel, Integer> implements PersonnelService {
  12 +}
src/main/java/com/bsth/service/schedule/rules/Message.java 0 → 100644
  1 +package com.bsth.service.schedule.rules;
  2 +
  3 +/**
  4 + * Created by xu on 16/6/15.
  5 + */
  6 +public class Message {
  7 + public static final int HELLO = 0;
  8 + public static final int GOODBYE = 1;
  9 +
  10 + private String message;
  11 + private int status;
  12 + public String getMessage() {
  13 + return message;
  14 + }
  15 + public void setMessage(String message) {
  16 + this.message = message;
  17 + }
  18 + public int getStatus() {
  19 + return status;
  20 + }
  21 + public void setStatus(int status) {
  22 + this.status = status;
  23 + }
  24 +}
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java 0 → 100644
  1 +package com.bsth.service.schedule.rules;
  2 +
  3 +import org.kie.api.KieBase;
  4 +import org.kie.api.KieBaseConfiguration;
  5 +import org.kie.api.KieServices;
  6 +import org.kie.api.builder.*;
  7 +import org.kie.api.builder.Message;
  8 +import org.kie.api.builder.model.KieBaseModel;
  9 +import org.kie.api.builder.model.KieModuleModel;
  10 +import org.kie.api.builder.model.KieSessionModel;
  11 +import org.kie.api.conf.EqualityBehaviorOption;
  12 +import org.kie.api.conf.EventProcessingOption;
  13 +import org.kie.api.runtime.KieContainer;
  14 +import org.kie.api.runtime.conf.ClockTypeOption;
  15 +import org.springframework.context.annotation.Bean;
  16 +import org.springframework.context.annotation.Configuration;
  17 +
  18 +/**
  19 + * Drools 6配置类。
  20 + */
  21 +@Configuration
  22 +public class MyDroolsConfiguration {
  23 + /**
  24 + * 返回一个kiebase知识库,直接冲文件系统读入drl规则文件,
  25 + * TODO:以后需要从数据库读入规则文件,并重新创建kbase知识库。
  26 + */
  27 + @Bean
  28 + public KieBase myKieBase() {
  29 + // Drools 6开始引入kie统一接口(jboss的jbpm工作流也使用kie接口了),整个定义方式和5差别很大
  30 + // 这里使用全api方式创建知识库对象,不使用xml的方式,提供最大的灵活性
  31 +
  32 + // 1、创建kieservices
  33 + KieServices kieServices = KieServices.Factory.get();
  34 + // 2、创建KieModuleModel,默认是由kmodule.xml的方式创建,这里使用api方式闯将
  35 + KieModuleModel kieModuleModel = kieServices.newKieModuleModel();
  36 + // 2.1、创建KieBaseModel,类似kmodule.xml中的kbase标签
  37 + KieBaseModel kieBaseModel1 = kieModuleModel.newKieBaseModel("KBase1")
  38 + .setDefault(true)
  39 + .setEqualsBehavior(EqualityBehaviorOption.EQUALITY)
  40 + .setEventProcessingMode(EventProcessingOption.STREAM);
  41 + // 2.2、创建与kbase关联的KieSessionModel,类似kmodule.xml中的kbase内的ksession标签
  42 + kieBaseModel1.newKieSessionModel("KSession1")
  43 + .setDefault(true)
  44 + .setType(KieSessionModel.KieSessionType.STATEFUL)
  45 + .setClockType(ClockTypeOption.get("realtime"));
  46 +
  47 + // 3、创建KieFileSystem,将模型xml,drl等写入,TODO:以后考虑从数据库中获取
  48 + KieFileSystem kfs = kieServices.newKieFileSystem();
  49 + // 3.1、写入KieBaseModel(内部包含了KieSessionModel的内容了,注意之前的KieSessionModel的创建方式)
  50 + kfs.writeKModuleXML(kieModuleModel.toXML());
  51 +
  52 + // 3.2、写入drl(写法超多,有点混乱)
  53 + // 这里使用文件的形式写入,TODO:以后考虑从数据库中读drl写入
  54 + // 注意kfs写的时候如果指定path,强制为src/main/resources/加上文件名,还有就是文件名不要重复否则会覆盖的
  55 + kfs.write("src/main/resources/HelloWorld.drl", kieServices.getResources()
  56 + .newInputStreamResource(this.getClass().getResourceAsStream(
  57 + "/rules/HelloWorld.drl"), "UTF-8"));
  58 + // TODO:还有其他drl....
  59 +
  60 + // 4、创建KieBuilder,使用KieFileSystem构建
  61 + KieBuilder kieBuilder = kieServices.newKieBuilder(kfs).buildAll();
  62 + Results results = kieBuilder.getResults();
  63 + if (results.hasMessages(Message.Level.ERROR))
  64 + throw new IllegalStateException("构建drools6错误:" + results.getMessages());
  65 +
  66 + // 5、获取KieContainer
  67 + // TODO:ReleaseId用处很大,以后再议
  68 + ReleaseId releaseId = kieServices.getRepository().getDefaultReleaseId();
  69 + KieContainer kieContainer = kieServices.newKieContainer(releaseId);
  70 +
  71 + // 6、创建kbase
  72 + KieBaseConfiguration kieBaseConfiguration = kieServices.newKieBaseConfiguration();
  73 + KieBase kieBase = kieContainer.newKieBase("KBase1", kieBaseConfiguration);
  74 +
  75 + return kieBase;
  76 + }
  77 +}
src/main/resources/rules/HelloWorld.drl 0 → 100644
  1 +package com.bsth.service.schedule
  2 +
  3 +//list any import classes here.
  4 +
  5 +import com.bsth.service.schedule.rules.Message;
  6 +
  7 +//declare any global variables here
  8 +
  9 +global java.util.List list
  10 +
  11 +
  12 +rule "Hello World"
  13 + dialect "mvel"
  14 + when
  15 + $m : Message( status == Message.HELLO, $message : message )
  16 + then
  17 + System.out.println($message);
  18 + $m.status = com.bsth.service.schedule.rules.Message.GOODBYE;
  19 + $m.message = "Goodbye cruel world";
  20 + update($m);
  21 +end
  22 +
  23 +rule "Good bye"
  24 + dialect "mvel"
  25 + when
  26 + $m : Message( status == Message.GOODBYE, $message : message )
  27 + then
  28 + System.out.println($message);
  29 + list.add("you come on!");
  30 +end
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/busInfoManage.js
@@ -348,7 +348,7 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;BusInfoManageFormCtrl&#39;, [&#39;BusInfoManag @@ -348,7 +348,7 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;BusInfoManageFormCtrl&#39;, [&#39;BusInfoManag
348 busInfoManageService.saveDetail(self.busInfoForSave).then( 348 busInfoManageService.saveDetail(self.busInfoForSave).then(
349 function(result) { 349 function(result) {
350 // TODO:弹出框方式以后改 350 // TODO:弹出框方式以后改
351 - if (result.status == 1) { 351 + if (result.status == 'SUCCESS') {
352 alert("保存成功!"); 352 alert("保存成功!");
353 $state.go("busInfoManage"); 353 $state.go("busInfoManage");
354 } else { 354 } else {
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/edit.html
@@ -77,7 +77,7 @@ @@ -77,7 +77,7 @@
77 </div> 77 </div>
78 <!-- 隐藏块,显示验证信息 --> 78 <!-- 隐藏块,显示验证信息 -->
79 <div class="alert alert-danger well-sm" ng-show="myForm.gs.$error.required"> 79 <div class="alert alert-danger well-sm" ng-show="myForm.gs.$error.required">
80 - 内部编号必须填写 80 + 公司必须选择
81 </div> 81 </div>
82 </div> 82 </div>
83 83
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/form.html
@@ -77,7 +77,7 @@ @@ -77,7 +77,7 @@
77 </div> 77 </div>
78 <!-- 隐藏块,显示验证信息 --> 78 <!-- 隐藏块,显示验证信息 -->
79 <div class="alert alert-danger well-sm" ng-show="myForm.gs.$error.required"> 79 <div class="alert alert-danger well-sm" ng-show="myForm.gs.$error.required">
80 - 内部编号必须填写 80 + 公司必须选择
81 </div> 81 </div>
82 </div> 82 </div>
83 83
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/detail.html
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>车辆设备详细信息</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li>
  9 + <a href="/pages/home.html" data-pjax>首页</a>
  10 + <i class="fa fa-circle"></i>
  11 + </li>
  12 + <li>
  13 + <span class="active">基础信息</span>
  14 + <i class="fa fa-circle"></i>
  15 + </li>
  16 + <li>
  17 + <a ui-sref="deviceInfoManage">车辆设备信息管理</a>
  18 + <i class="fa fa-circle"></i>
  19 + </li>
  20 + <li>
  21 + <span class="active">车辆设备详细信息</span>
  22 + </li>
  23 +</ul>
  24 +
  25 +<div class="portlet light bordered" ng-controller="DeviceInfoManageDetailCtrl as ctrl">
  26 + <div class="portlet-title">
  27 + <div class="caption">
  28 + <i class="icon-equalizer font-red-sunglo"></i> <span
  29 + class="caption-subject font-red-sunglo bold uppercase"
  30 + ng-bind="ctrl.title"></span>
  31 + </div>
  32 + </div>
  33 +
  34 + <div class="portlet-body form">
  35 + <form class="form-horizontal" novalidate name="myForm">
  36 + <div class="form-body">
  37 + <div class="form-group has-success has-feedback">
  38 + <label class="col-md-2 control-label">所属公司*:</label>
  39 + <div class="col-md-3">
  40 + <input type="text" class="form-control" name="gsName"
  41 + ng-model="ctrl.deviceInfoForDetail.gsName" readonly/>
  42 + </div>
  43 + </div>
  44 + <div class="form-group has-success has-feedback">
  45 + <label class="col-md-2 control-label">车辆内部编号/自编号*:</label>
  46 + <div class="col-md-3">
  47 + <input type="text" class="form-control" name="clZbh"
  48 + ng-model="ctrl.deviceInfoForDetail.clZbh" readonly/>
  49 + </div>
  50 + </div>
  51 + <div class="form-group has-success has-feedback">
  52 + <label class="col-md-2 control-label">线路*:</label>
  53 + <div class="col-md-3">
  54 + <input type="text" class="form-control" name="xlName"
  55 + ng-model="ctrl.deviceInfoForDetail.xlName" readonly/>
  56 + </div>
  57 + </div>
  58 + <div class="form-group has-success has-feedback">
  59 + <label class="col-md-2 control-label">旧终端号*:</label>
  60 + <div class="col-md-3">
  61 + <input type="text" class="form-control" name="oldDeviceNo"
  62 + ng-model="ctrl.deviceInfoForDetail.oldDeviceNo" readonly/>
  63 + </div>
  64 + </div>
  65 + <div class="form-group has-success has-feedback">
  66 + <label class="col-md-2 control-label">新终端号*:</label>
  67 + <div class="col-md-3">
  68 + <input type="text" class="form-control" name="newDeviceNo"
  69 + ng-model="ctrl.deviceInfoForDetail.newDeviceNo" readonly/>
  70 + </div>
  71 + </div>
  72 +
  73 + <div class="form-group">
  74 + <label class="col-md-2 control-label">旧SIM卡号:</label>
  75 + <div class="col-md-4">
  76 + <input type="text" class="form-control" name="oldSimNo"
  77 + ng-model="ctrl.deviceInfoForDetail.oldSimNo" readonly/>
  78 + </div>
  79 + </div>
  80 + <div class="form-group">
  81 + <label class="col-md-2 control-label">新SIM卡号:</label>
  82 + <div class="col-md-4">
  83 + <input type="text" class="form-control" name="newSimNo"
  84 + ng-model="ctrl.deviceInfoForDetail.newSimNo" readonly/>
  85 + </div>
  86 + </div>
  87 +
  88 + <div class="form-group">
  89 + <label class="col-md-2 control-label">故障描述:</label>
  90 + <div class="col-md-10">
  91 + <textarea rows="3" class="form-control" name="troubleDesc"
  92 + ng-model="ctrl.deviceInfoForDetail.troubleDesc" readonly></textarea>
  93 + </div>
  94 + </div>
  95 +
  96 + <div class="form-group">
  97 + <label class="col-md-2 control-label">保修描述:</label>
  98 + <div class="col-md-10">
  99 + <textarea rows="3" class="form-control" name="guaranteeDesc"
  100 + ng-model="ctrl.deviceInfoForDetail.guaranteeDesc" readonly></textarea>
  101 + </div>
  102 + </div>
  103 +
  104 + <!-- 其他form-group -->
  105 +
  106 + </div>
  107 + </form>
  108 + </div>
  109 +
  110 +</div>
0 \ No newline at end of file 111 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/deviceInfoManage.js
1 // 设备信息维护 service controller 等写在一起 1 // 设备信息维护 service controller 等写在一起
2 2
3 -angular.module('ScheduleApp').factory('DeviceInfoManageService', ['$resource', function($resource) {  
4 - // TODO:测试  
5 - var pageInfo = {  
6 - totalItems: 64,  
7 - currentPage: 4,  
8 - infos: []  
9 - }; 3 +angular.module('ScheduleApp').factory('DeviceInfoManageService', ['DeviceInfoManageService_g', function(service) {
  4 + /** 公司字典 */
  5 + var gses = [
  6 + {gsdm: "55", gsmc: "上南公司"},
  7 + {gsdm: "22", gsmc: "金高公司"},
  8 + {gsdm: "05", gsmc: "杨高公司"},
  9 + {gsdm: "26", gsmc: "南汇公司"}
  10 + ];
  11 +
  12 + /** 当前的查询条件信息 */
  13 + var currentSearchCondition = {};
  14 +
  15 + /** 当前第几页 */
  16 + var currentPageNo = 1;
10 17
11 return { 18 return {
12 - pi: function() {  
13 - console.log("pi");  
14 - return pageInfo; 19 + /**
  20 + * 获取公司字典。
  21 + */
  22 + getGses: function() {
  23 + return gses;
  24 + },
  25 + /**
  26 + * 获取查询条件信息,
  27 + * 用于给controller用来和页面数据绑定。
  28 + */
  29 + getSearchCondition: function() {
  30 + return currentSearchCondition;
15 }, 31 },
16 - setCP: function(cp) {  
17 - console.log("setCP");  
18 - pageInfo.currentPage = cp; 32 + /**
  33 + * 重置查询条件信息。
  34 + */
  35 + resetSearchCondition: function() {
  36 + var key;
  37 + for (key in currentSearchCondition) {
  38 + currentSearchCondition[key] = "";
  39 + }
  40 + },
  41 + /**
  42 + * 设置当前页码。
  43 + * @param cpn 从1开始,后台是从0开始的
  44 + */
  45 + setCurrentPageNo: function(cpn) {
  46 + currentPageNo = cpn;
  47 + },
  48 + /**
  49 + * 组装查询参数,返回一个promise查询结果。
  50 + * @param params 查询参数
  51 + * @return 返回一个 promise
  52 + */
  53 + getPage: function() {
  54 + var params = currentSearchCondition; // 查询条件
  55 + params.page = currentPageNo - 1; // 服务端页码从0开始
  56 + return service.list(params).$promise;
  57 + },
  58 + /**
  59 + * 获取明细信息。
  60 + * @param id 车辆id
  61 + * @return 返回一个 promise
  62 + */
  63 + getDetail: function(id) {
  64 + var params = {id: id};
  65 + return service.get(params).$promise;
  66 + },
  67 + /**
  68 + * 保存信息。
  69 + * @param obj 车辆详细信息
  70 + * @return 返回一个 promise
  71 + */
  72 + saveDetail: function(obj) {
  73 + return service.save(obj).$promise;
19 } 74 }
20 - } 75 + };
  76 +
21 }]); 77 }]);
22 78
23 -angular.module('ScheduleApp').controller('DeviceInfoManageCtrl', ['DeviceInfoManageService', function(deviceInfoManageService) { 79 +angular.module('ScheduleApp').controller('DeviceInfoManageCtrl', ['DeviceInfoManageService', '$state', function(deviceInfoManageService, $state) {
  80 + var self = this;
  81 +
  82 + // 切换到form状态
  83 + self.goForm = function() {
  84 + //alert("切换");
  85 + $state.go("deviceInfoManage_form");
  86 + }
  87 +
24 88
25 }]); 89 }]);
26 90
27 angular.module('ScheduleApp').controller('DeviceInfoManageListCtrl', ['DeviceInfoManageService', function(deviceInfoManageService) { 91 angular.module('ScheduleApp').controller('DeviceInfoManageListCtrl', ['DeviceInfoManageService', function(deviceInfoManageService) {
28 - // TODO:模拟数据  
29 var self = this; 92 var self = this;
30 - self.pi = deviceInfoManageService.pi(); 93 + self.pageInfo = {
  94 + totalItems : 0,
  95 + currentPage : 1,
  96 + infos: []
  97 + };
  98 +
  99 + // 初始创建的时候,获取一次列表数据
  100 + deviceInfoManageService.getPage().then(
  101 + function(result) {
  102 + self.pageInfo.totalItems = result.totalElements;
  103 + self.pageInfo.currentPage = result.number + 1;
  104 + self.pageInfo.infos = result.content;
  105 + deviceInfoManageService.setCurrentPageNo(result.number + 1);
  106 + },
  107 + function(result) {
  108 + alert("出错啦!");
  109 + }
  110 + );
  111 +
  112 + // 翻页的时候调用
31 self.pageChanaged = function() { 113 self.pageChanaged = function() {
32 - console.log("go:" + deviceInfoManageService.pi().currentPage); 114 + deviceInfoManageService.setCurrentPageNo(self.pageInfo.currentPage);
  115 + deviceInfoManageService.getPage().then(
  116 + function(result) {
  117 + self.pageInfo.totalItems = result.totalElements;
  118 + self.pageInfo.currentPage = result.number + 1;
  119 + self.pageInfo.infos = result.content;
  120 + deviceInfoManageService.setCurrentPageNo(result.number + 1);
  121 + },
  122 + function(result) {
  123 + alert("出错啦!");
  124 + }
  125 + );
  126 + };
  127 + // 获取查询条件数据
  128 + self.searchCondition = function() {
  129 + return deviceInfoManageService.getSearchCondition();
  130 + };
  131 + // 重置查询条件
  132 + self.resetSearchCondition = function() {
  133 + return deviceInfoManageService.resetSearchCondition();
33 }; 134 };
34 135
35 }]); 136 }]);
36 137
37 -angular.module('ScheduleApp').controller('DeviceInfoManageFormCtrl', ['DeviceInfoManageService', function(deviceInfoManageService) { 138 +angular.module('ScheduleApp').controller('DeviceInfoManageFormCtrl', ['DeviceInfoManageService', '$stateParams', '$state', function(deviceInfoManageService, $stateParams, $state) {
  139 + var self = this;
  140 +
  141 + // 欲保存的busInfo信息,绑定
  142 + self.deviceInfoForSave = {};
  143 +
  144 + // 公司 selectedItem
  145 + self.deviceInfoForSave.gs_selected = null;
  146 + self.gses = deviceInfoManageService.getGses();
  147 + self.gs_selected_change = function($item, $model) {
  148 + self.deviceInfoForSave.gsName = $item.gsmc;
  149 + };
  150 + self.gs_selected_remove = function() {
  151 + self.deviceInfoForSave.gs_selected = null;
  152 + self.deviceInfoForSave.gsName = null;
  153 + };
  154 +
  155 + // 获取传过来的id,有的话就是修改,获取一遍数据
  156 + var id = $stateParams.id;
  157 + if (id) {
  158 + self.deviceInfoForSave.id = id;
  159 + deviceInfoManageService.getDetail(id).then(
  160 + function(result) {
  161 + var key;
  162 + for (key in result) {
  163 + self.deviceInfoForSave[key] = result[key];
  164 + }
  165 + // 填写所有的 select 控件选中框数据
  166 + // 公司字典
  167 + if (self.deviceInfoForSave.gsName) {
  168 + angular.forEach(self.gses, function(data) {
  169 + if (self.deviceInfoForSave.gsName == data.gsmc) {
  170 + self.deviceInfoForSave.gs_selected = data;
  171 + }
  172 + });
  173 + }
  174 + },
  175 + function(result) {
  176 + alert("出错啦!");
  177 + }
  178 + );
  179 + }
  180 +
  181 + // 提交方法
  182 + self.submit = function() {
  183 + console.log(self.deviceInfoForSave);
  184 + deviceInfoManageService.saveDetail(self.deviceInfoForSave).then(
  185 + function(result) {
  186 + // TODO:弹出框方式以后改
  187 + if (result.status == 'SUCCESS') {
  188 + alert("保存成功!");
  189 + $state.go("deviceInfoManage");
  190 + } else {
  191 + alert("保存异常!");
  192 + }
  193 + },
  194 + function(result) {
  195 + // TODO:弹出框方式以后改
  196 + alert("出错啦!");
  197 + }
  198 + );
  199 + };
38 200
39 }]); 201 }]);
40 202
41 -angular.module('ScheduleApp').controller('DeviceInfoManageDetailCtrl', ['DeviceInfoManageService', function(deviceInfoManageService) { 203 +angular.module('ScheduleApp').controller('DeviceInfoManageDetailCtrl', ['DeviceInfoManageService', '$stateParams', function(deviceInfoManageService, $stateParams) {
  204 + var self = this;
  205 + self.title = "";
  206 + self.deviceInfoForDetail = {};
  207 + self.deviceInfoForDetail.id = $stateParams.id;
  208 +
  209 + // 当转向到此页面时,就获取明细信息并绑定
  210 + deviceInfoManageService.getDetail($stateParams.id).then(
  211 + function(result) {
  212 + var key;
  213 + for (key in result) {
  214 + self.deviceInfoForDetail[key] = result[key];
  215 + }
42 216
  217 + self.title = "车辆 " + self.deviceInfoForDetail.clZbh + " 详细信息";
  218 + },
  219 + function(result) {
  220 + // TODO:弹出框方式以后改
  221 + alert("出错啦!");
  222 + }
  223 + );
43 }]); 224 }]);
44 \ No newline at end of file 225 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/edit.html 0 → 100644
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>修改车辆设备信息</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li>
  9 + <a href="/pages/home.html" data-pjax>首页</a>
  10 + <i class="fa fa-circle"></i>
  11 + </li>
  12 + <li>
  13 + <span class="active">基础信息</span>
  14 + <i class="fa fa-circle"></i>
  15 + </li>
  16 + <li>
  17 + <a ui-sref="deviceInfoManage">车辆设备信息管理</a>
  18 + <i class="fa fa-circle"></i>
  19 + </li>
  20 + <li>
  21 + <span class="active">修改车辆设备信息</span>
  22 + </li>
  23 +</ul>
  24 +
  25 +<div class="portlet light bordered" ng-controller="DeviceInfoManageFormCtrl as ctrl">
  26 + <div class="portlet-title">
  27 + <div class="caption">
  28 + <i class="icon-equalizer font-red-sunglo"></i> <span
  29 + class="caption-subject font-red-sunglo bold uppercase">表单</span>
  30 + </div>
  31 + </div>
  32 +
  33 + <div class="portlet-body form">
  34 + <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm">
  35 + <div class="form-body">
  36 + <div class="form-group has-success has-feedback">
  37 + <label class="col-md-2 control-label">所属公司*:</label>
  38 + <div class="col-md-3">
  39 + <div class="input-group">
  40 + <ui-select ng-model="ctrl.deviceInfoForSave.gs_selected"
  41 + on-select="ctrl.gs_selected_change($item, $model)"
  42 + theme="bootstrap" name="gs" required>
  43 + <ui-select-match placeholder="请选择所属公司...">{{$select.selected.gsmc}}</ui-select-match>
  44 + <ui-select-choices repeat="item in ctrl.gses">
  45 + <span ng-bind="item.gsmc"></span>
  46 + </ui-select-choices>
  47 + </ui-select>
  48 + <span class="input-group-btn">
  49 + <button type="button" ng-click="ctrl.gs_selected_remove()" class="btn btn-default">
  50 + <span class="glyphicon glyphicon-trash"></span>
  51 + </button>
  52 + </span>
  53 + </div>
  54 + </div>
  55 + <!-- 隐藏块,显示验证信息 -->
  56 + <div class="alert alert-danger well-sm" ng-show="myForm.gs.$error.required">
  57 + 公司必须选择
  58 + </div>
  59 + </div>
  60 +
  61 + <div class="form-group has-success has-feedback">
  62 + <label class="col-md-2 control-label">车辆内部编号/自编号*:</label>
  63 + <div class="col-md-3">
  64 + <input type="text" class="form-control"
  65 + name="clZbh" ng-model="ctrl.deviceInfoForSave.clZbh"
  66 + required placeholder="请输入车辆内部编号/自编号"/>
  67 + </div>
  68 + <!-- 隐藏块,显示验证信息 -->
  69 + <div class="alert alert-danger well-sm" ng-show="myForm.clZbh.$error.required">
  70 + 车辆内部编号/自编号必须填写
  71 + </div>
  72 + </div>
  73 +
  74 + <div class="form-group has-success has-feedback">
  75 + <label class="col-md-2 control-label">线路*:</label>
  76 + <div class="col-md-3">
  77 + <input type="text" class="form-control"
  78 + name="xlName" ng-model="ctrl.deviceInfoForSave.xlName"
  79 + required placeholder="请输入线路"/>
  80 + </div>
  81 + <!-- 隐藏块,显示验证信息 -->
  82 + <div class="alert alert-danger well-sm" ng-show="myForm.xlName.$error.required">
  83 + 线路必须填写
  84 + </div>
  85 + </div>
  86 +
  87 + <div class="form-group has-success has-feedback">
  88 + <label class="col-md-2 control-label">旧终端号*:</label>
  89 + <div class="col-md-3">
  90 + <input type="text" class="form-control"
  91 + name="oldDeviceNo" ng-model="ctrl.deviceInfoForSave.oldDeviceNo"
  92 + required placeholder="请输入旧终端号"/>
  93 + </div>
  94 + <!-- 隐藏块,显示验证信息 -->
  95 + <div class="alert alert-danger well-sm" ng-show="myForm.oldDeviceNo.$error.required">
  96 + 旧终端号必须填写
  97 + </div>
  98 + </div>
  99 +
  100 + <div class="form-group has-success has-feedback">
  101 + <label class="col-md-2 control-label">新终端号*:</label>
  102 + <div class="col-md-3">
  103 + <input type="text" class="form-control"
  104 + name="newDeviceNo" ng-model="ctrl.deviceInfoForSave.newDeviceNo"
  105 + required placeholder="请输入新终端号"/>
  106 + </div>
  107 + <!-- 隐藏块,显示验证信息 -->
  108 + <div class="alert alert-danger well-sm" ng-show="myForm.newDeviceNo.$error.required">
  109 + 新终端号必须填写
  110 + </div>
  111 + </div>
  112 +
  113 + <div class="form-group">
  114 + <label class="col-md-2 control-label">旧SIM卡号:</label>
  115 + <div class="col-md-4">
  116 + <input type="text" class="form-control" ng-model="ctrl.deviceInfoForSave.oldSimNo"
  117 + placeholder="请输入旧SIM卡号"/>
  118 + </div>
  119 + </div>
  120 +
  121 + <div class="form-group">
  122 + <label class="col-md-2 control-label">新SIM卡号:</label>
  123 + <div class="col-md-4">
  124 + <input type="text" class="form-control" ng-model="ctrl.deviceInfoForSave.newSimNo"
  125 + placeholder="请输入新SIM卡号"/>
  126 + </div>
  127 + </div>
  128 +
  129 + <div class="form-group">
  130 + <label class="col-md-2 control-label">故障描述:</label>
  131 + <div class="col-md-10">
  132 + <textarea rows="3" class="form-control" name="descriptions"
  133 + ng-model="ctrl.deviceInfoForSave.troubleDesc"></textarea>
  134 + </div>
  135 + </div>
  136 +
  137 + <div class="form-group">
  138 + <label class="col-md-2 control-label">保修描述:</label>
  139 + <div class="col-md-10">
  140 + <textarea rows="3" class="form-control" name="descriptions"
  141 + ng-model="ctrl.deviceInfoForSave.guaranteeDesc"></textarea>
  142 + </div>
  143 + </div>
  144 +
  145 + <!-- 其他form-group -->
  146 +
  147 + </div>
  148 +
  149 + <div class="form-actions">
  150 + <div class="row">
  151 + <div class="col-md-offset-3 col-md-4">
  152 + <button type="submit" class="btn green" ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button>
  153 + <a type="button" class="btn default" ui-sref="deviceInfoManage" ><i class="fa fa-times"></i> 取消</a>
  154 + </div>
  155 + </div>
  156 + </div>
  157 + </form>
  158 + </div>
  159 +
  160 +</div>
0 \ No newline at end of file 161 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/form.html
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>添加车辆设备信息</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li>
  9 + <a href="/pages/home.html" data-pjax>首页</a>
  10 + <i class="fa fa-circle"></i>
  11 + </li>
  12 + <li>
  13 + <span class="active">基础信息</span>
  14 + <i class="fa fa-circle"></i>
  15 + </li>
  16 + <li>
  17 + <a ui-sref="deviceInfoManage">车辆设备信息管理</a>
  18 + <i class="fa fa-circle"></i>
  19 + </li>
  20 + <li>
  21 + <span class="active">添加车辆设备信息</span>
  22 + </li>
  23 +</ul>
  24 +
  25 +<div class="portlet light bordered" ng-controller="DeviceInfoManageFormCtrl as ctrl">
  26 + <div class="portlet-title">
  27 + <div class="caption">
  28 + <i class="icon-equalizer font-red-sunglo"></i> <span
  29 + class="caption-subject font-red-sunglo bold uppercase">表单</span>
  30 + </div>
  31 + </div>
  32 +
  33 + <div class="portlet-body form">
  34 + <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm">
  35 + <div class="form-body">
  36 + <div class="form-group has-success has-feedback">
  37 + <label class="col-md-2 control-label">所属公司*:</label>
  38 + <div class="col-md-3">
  39 + <div class="input-group">
  40 + <ui-select ng-model="ctrl.deviceInfoForSave.gs_selected"
  41 + on-select="ctrl.gs_selected_change($item, $model)"
  42 + theme="bootstrap" name="gs" required>
  43 + <ui-select-match placeholder="请选择所属公司...">{{$select.selected.gsmc}}</ui-select-match>
  44 + <ui-select-choices repeat="item in ctrl.gses">
  45 + <span ng-bind="item.gsmc"></span>
  46 + </ui-select-choices>
  47 + </ui-select>
  48 + <span class="input-group-btn">
  49 + <button type="button" ng-click="ctrl.gs_selected_remove()" class="btn btn-default">
  50 + <span class="glyphicon glyphicon-trash"></span>
  51 + </button>
  52 + </span>
  53 + </div>
  54 + </div>
  55 + <!-- 隐藏块,显示验证信息 -->
  56 + <div class="alert alert-danger well-sm" ng-show="myForm.gs.$error.required">
  57 + 公司必须选择
  58 + </div>
  59 + </div>
  60 +
  61 + <div class="form-group has-success has-feedback">
  62 + <label class="col-md-2 control-label">车辆内部编号/自编号*:</label>
  63 + <div class="col-md-3">
  64 + <input type="text" class="form-control"
  65 + name="clZbh" ng-model="ctrl.deviceInfoForSave.clZbh"
  66 + required placeholder="请输入车辆内部编号/自编号"/>
  67 + </div>
  68 + <!-- 隐藏块,显示验证信息 -->
  69 + <div class="alert alert-danger well-sm" ng-show="myForm.clZbh.$error.required">
  70 + 车辆内部编号/自编号必须填写
  71 + </div>
  72 + </div>
  73 +
  74 + <div class="form-group has-success has-feedback">
  75 + <label class="col-md-2 control-label">线路*:</label>
  76 + <div class="col-md-3">
  77 + <input type="text" class="form-control"
  78 + name="xlName" ng-model="ctrl.deviceInfoForSave.xlName"
  79 + required placeholder="请输入线路"/>
  80 + </div>
  81 + <!-- 隐藏块,显示验证信息 -->
  82 + <div class="alert alert-danger well-sm" ng-show="myForm.xlName.$error.required">
  83 + 线路必须填写
  84 + </div>
  85 + </div>
  86 +
  87 + <div class="form-group has-success has-feedback">
  88 + <label class="col-md-2 control-label">旧终端号*:</label>
  89 + <div class="col-md-3">
  90 + <input type="text" class="form-control"
  91 + name="oldDeviceNo" ng-model="ctrl.deviceInfoForSave.oldDeviceNo"
  92 + required placeholder="请输入旧终端号"/>
  93 + </div>
  94 + <!-- 隐藏块,显示验证信息 -->
  95 + <div class="alert alert-danger well-sm" ng-show="myForm.oldDeviceNo.$error.required">
  96 + 旧终端号必须填写
  97 + </div>
  98 + </div>
  99 +
  100 + <div class="form-group has-success has-feedback">
  101 + <label class="col-md-2 control-label">新终端号*:</label>
  102 + <div class="col-md-3">
  103 + <input type="text" class="form-control"
  104 + name="newDeviceNo" ng-model="ctrl.deviceInfoForSave.newDeviceNo"
  105 + required placeholder="请输入新终端号"/>
  106 + </div>
  107 + <!-- 隐藏块,显示验证信息 -->
  108 + <div class="alert alert-danger well-sm" ng-show="myForm.newDeviceNo.$error.required">
  109 + 新终端号必须填写
  110 + </div>
  111 + </div>
  112 +
  113 + <div class="form-group">
  114 + <label class="col-md-2 control-label">旧SIM卡号:</label>
  115 + <div class="col-md-4">
  116 + <input type="text" class="form-control" ng-model="ctrl.deviceInfoForSave.oldSimNo"
  117 + placeholder="请输入旧SIM卡号"/>
  118 + </div>
  119 + </div>
  120 +
  121 + <div class="form-group">
  122 + <label class="col-md-2 control-label">新SIM卡号:</label>
  123 + <div class="col-md-4">
  124 + <input type="text" class="form-control" ng-model="ctrl.deviceInfoForSave.newSimNo"
  125 + placeholder="请输入新SIM卡号"/>
  126 + </div>
  127 + </div>
  128 +
  129 + <div class="form-group">
  130 + <label class="col-md-2 control-label">故障描述:</label>
  131 + <div class="col-md-10">
  132 + <textarea rows="3" class="form-control" name="descriptions"
  133 + ng-model="ctrl.deviceInfoForSave.troubleDesc"></textarea>
  134 + </div>
  135 + </div>
  136 +
  137 + <div class="form-group">
  138 + <label class="col-md-2 control-label">保修描述:</label>
  139 + <div class="col-md-10">
  140 + <textarea rows="3" class="form-control" name="descriptions"
  141 + ng-model="ctrl.deviceInfoForSave.guaranteeDesc"></textarea>
  142 + </div>
  143 + </div>
  144 +
  145 + <!-- 其他form-group -->
  146 +
  147 + </div>
  148 +
  149 + <div class="form-actions">
  150 + <div class="row">
  151 + <div class="col-md-offset-3 col-md-4">
  152 + <button type="submit" class="btn green" ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button>
  153 + <a type="button" class="btn default" ui-sref="deviceInfoManage" ><i class="fa fa-times"></i> 取消</a>
  154 + </div>
  155 + </div>
  156 + </div>
  157 + </form>
  158 + </div>
  159 +
  160 +</div>
0 \ No newline at end of file 161 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/index.html
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 <span class="caption-subject bold uppercase">设备信息表</span> 27 <span class="caption-subject bold uppercase">设备信息表</span>
28 </div> 28 </div>
29 <div class="actions"> 29 <div class="actions">
30 - <a href="javascirpt:" class="btn btn-circle blue"> 30 + <a href="javascirpt:" class="btn btn-circle blue" ng-click="ctrl.goForm()">
31 <i class="fa fa-plus"></i> 31 <i class="fa fa-plus"></i>
32 添加设备信息 32 添加设备信息
33 </a> 33 </a>
@@ -58,7 +58,7 @@ @@ -58,7 +58,7 @@
58 </div> 58 </div>
59 59
60 <div class="portlet-body"> 60 <div class="portlet-body">
61 - <div ui-view="list"></div> 61 + <div ui-view="deviceInfoManage_list"></div>
62 </div> 62 </div>
63 </div> 63 </div>
64 </div> 64 </div>
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/list.html
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <div ng-controller="DeviceInfoManageListCtrl as ctrl"> 2 <div ng-controller="DeviceInfoManageListCtrl as ctrl">
3 <table class="table table-striped table-bordered table-hover table-checkable order-column"> 3 <table class="table table-striped table-bordered table-hover table-checkable order-column">
4 <thead> 4 <thead>
5 - <tr> 5 + <tr role="row" class="heading">
6 <th> 6 <th>
7 <input type="checkbox" class="group-checkable"/> 7 <input type="checkbox" class="group-checkable"/>
8 </th> 8 </th>
@@ -15,16 +15,50 @@ @@ -15,16 +15,50 @@
15 <th>旧SIM卡</th> 15 <th>旧SIM卡</th>
16 <th>新SIM卡</th> 16 <th>新SIM卡</th>
17 <th>操作时间</th> 17 <th>操作时间</th>
18 - <th>操作</th> 18 + <th width="14%">操作</th>
  19 + </tr>
  20 + <tr role="row" class="filter">
  21 + <td></td>
  22 + <td></td>
  23 + <td>
  24 + <input type="text" class="form-control input-sm" ng-model="ctrl.searchCondition().xlName_like"/>
  25 + </td>
  26 + <td>
  27 + <input type="text" class="form-control input-sm" ng-model="ctrl.searchCondition().clZbh_like"/>
  28 + </td>
  29 + <td></td>
  30 + <td>
  31 + <input type="text" class="form-control input-sm" ng-model="ctrl.searchCondition().oldDeviceNo_like"/>
  32 + </td>
  33 + <td>
  34 + <input type="text" class="form-control input-sm" ng-model="ctrl.searchCondition().newDeviceNo_like"/>
  35 + </td>
  36 + <td>
  37 + <input type="text" class="form-control input-sm" ng-model="ctrl.searchCondition().oldSimNo_like"/>
  38 + </td>
  39 + <td>
  40 + <input type="text" class="form-control input-sm" ng-model="ctrl.searchCondition().newSimNo_like"/>
  41 + </td>
  42 + <td></td>
  43 + <td>
  44 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
  45 + ng-click="ctrl.pageChanaged()">
  46 + <i class="fa fa-search"></i> 搜索</button>
  47 +
  48 + <button class="btn btn-sm red btn-outline filter-cancel"
  49 + ng-click="ctrl.resetSearchCondition()">
  50 + <i class="fa fa-times"></i> 重置</button>
  51 + </td>
  52 +
19 </tr> 53 </tr>
20 </thead> 54 </thead>
21 <tbody> 55 <tbody>
22 - <tr ng-repeat="info in ctrl.infos" class="odd gradeX"> 56 + <tr ng-repeat="info in ctrl.pageInfo.infos" class="odd gradeX">
23 <td> 57 <td>
24 <input type="checkbox"/> 58 <input type="checkbox"/>
25 </td> 59 </td>
26 <td> 60 <td>
27 - <span>todo</span> 61 + <span ng-bind="$index + 1"></span>
28 </td> 62 </td>
29 <td> 63 <td>
30 <span ng-bind="info.xlName"></span> 64 <span ng-bind="info.xlName"></span>
@@ -51,7 +85,10 @@ @@ -51,7 +85,10 @@
51 <span ng-bind="info.updateDate | date:'yyyy-MM-dd HH:mm:ss'"></span> 85 <span ng-bind="info.updateDate | date:'yyyy-MM-dd HH:mm:ss'"></span>
52 </td> 86 </td>
53 <td> 87 <td>
54 - <span>todo</span> 88 + <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
  89 + <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
  90 + <a ui-sref="deviceInfoManage_detail({id: info.id})" class="btn default blue-stripe btn-sm"> 详细 </a>
  91 + <a ui-sref="deviceInfoManage_edit({id: info.id})" class="btn default blue-stripe btn-sm"> 修改 </a>
55 </td> 92 </td>
56 </tr> 93 </tr>
57 </tbody> 94 </tbody>
@@ -59,11 +96,16 @@ @@ -59,11 +96,16 @@
59 </table> 96 </table>
60 97
61 <div style="text-align: right;"> 98 <div style="text-align: right;">
62 - <uib-pagination total-items="ctrl.pi.totalItems"  
63 - ng-model="ctrl.pi.currentPage"  
64 - ng-change="ctrl.pageChanged()" 99 + <uib-pagination total-items="ctrl.pageInfo.totalItems"
  100 + ng-model="ctrl.pageInfo.currentPage"
  101 + ng-change="ctrl.pageChanaged()"
  102 + rotate="false"
  103 + max-size="10"
  104 + boundary-links="true"
  105 + first-text="首页"
65 previous-text="上一页" 106 previous-text="上一页"
66 - next-text="下一页"> 107 + next-text="下一页"
  108 + last-text="尾页">
67 </uib-pagination> 109 </uib-pagination>
68 </div> 110 </div>
69 </div> 111 </div>
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/detail.html
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>人员详细信息</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li>
  9 + <a href="/pages/home.html" data-pjax>首页</a>
  10 + <i class="fa fa-circle"></i>
  11 + </li>
  12 + <li>
  13 + <span class="active">基础信息</span>
  14 + <i class="fa fa-circle"></i>
  15 + </li>
  16 + <li>
  17 + <a ui-sref="employeeInfoManage">人员信息管理</a>
  18 + <i class="fa fa-circle"></i>
  19 + </li>
  20 + <li>
  21 + <span class="active">人员详细信息</span>
  22 + </li>
  23 +</ul>
  24 +
  25 +<div class="portlet light bordered" ng-controller="EmployeeInfoManageDetailCtrl as ctrl">
  26 + <div class="portlet-title">
  27 + <div class="caption">
  28 + <i class="icon-equalizer font-red-sunglo"></i> <span
  29 + class="caption-subject font-red-sunglo bold uppercase"
  30 + ng-bind="ctrl.title"></span>
  31 + </div>
  32 + </div>
  33 +
  34 + <div class="portlet-body form">
  35 + <form class="form-horizontal" novalidate name="myForm">
  36 + <div class="form-body">
  37 + <div class="form-group has-success has-feedback">
  38 + <label class="col-md-2 control-label">所属公司*:</label>
  39 + <div class="col-md-3">
  40 + <input type="text" class="form-control" name="company"
  41 + ng-model="ctrl.employeeInfoForDetail.company" readonly/>
  42 + </div>
  43 + </div>
  44 + <div class="form-group">
  45 + <label class="col-md-2 control-label">所属分公司:</label>
  46 + <div class="col-md-3">
  47 + <input type="text" class="form-control" name="brancheCompany"
  48 + ng-model="ctrl.employeeInfoForDetail.brancheCompany" readonly/>
  49 + </div>
  50 + </div>
  51 + <div class="form-group has-success has-feedback">
  52 + <label class="col-md-2 control-label">工号*:</label>
  53 + <div class="col-md-3">
  54 + <input type="text" class="form-control" name="jobCode"
  55 + ng-model="ctrl.employeeInfoForDetail.jobCode" readonly/>
  56 + </div>
  57 + </div>
  58 + <div class="form-group has-success has-feedback">
  59 + <label class="col-md-2 control-label">姓名*:</label>
  60 + <div class="col-md-3">
  61 + <input type="text" class="form-control" name="personnelName"
  62 + ng-model="ctrl.employeeInfoForDetail.personnelName" readonly/>
  63 + </div>
  64 + </div>
  65 + <div class="form-group">
  66 + <label class="col-md-2 control-label">运营服务证书号:</label>
  67 + <div class="col-md-4">
  68 + <input type="text" class="form-control" name="papersCode"
  69 + ng-model="ctrl.employeeInfoForDetail.papersCode" readonly/>
  70 + </div>
  71 + </div>
  72 + <div class="form-group">
  73 + <label class="col-md-2 control-label">一卡通工作卡号:</label>
  74 + <div class="col-md-4">
  75 + <input type="text" class="form-control" name="icCardCode"
  76 + ng-model="ctrl.employeeInfoForDetail.icCardCode" readonly/>
  77 + </div>
  78 + </div>
  79 + <div class="form-group">
  80 + <label class="col-md-2 control-label">性别:</label>
  81 + <div class="col-md-4">
  82 + <label class="radio-inline">
  83 + <input type="radio" name="ledScreen" ng-value="'男性'" ng-model="ctrl.employeeInfoForDetail.personnelType" disabled/>男性
  84 + </label>
  85 + <label class="radio-inline">
  86 + <input type="radio" name="ledScreen" ng-value="'女性'" ng-model="ctrl.employeeInfoForDetail.personnelType" disabled/>女性
  87 + </label>
  88 + </div>
  89 + </div>
  90 + <div class="form-group">
  91 + <label class="col-md-2 control-label">工种:</label>
  92 + <div class="col-md-4">
  93 + <input type="text" class="form-control" name="posts"
  94 + ng-model="ctrl.employeeInfoForDetail.posts" readonly/>
  95 + </div>
  96 + </div>
  97 +
  98 + <!-- 其他form-group -->
  99 +
  100 + </div>
  101 + </form>
  102 + </div>
  103 +
  104 +</div>
0 \ No newline at end of file 105 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/edit.html 0 → 100644
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>修改人员信息</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li>
  9 + <a href="/pages/home.html" data-pjax>首页</a>
  10 + <i class="fa fa-circle"></i>
  11 + </li>
  12 + <li>
  13 + <span class="active">基础信息</span>
  14 + <i class="fa fa-circle"></i>
  15 + </li>
  16 + <li>
  17 + <a ui-sref="employeeInfoManage">人员信息管理</a>
  18 + <i class="fa fa-circle"></i>
  19 + </li>
  20 + <li>
  21 + <span class="active">修改人员信息</span>
  22 + </li>
  23 +</ul>
  24 +
  25 +<div class="portlet light bordered" ng-controller="EmployeeInfoManageFormCtrl as ctrl">
  26 + <div class="portlet-title">
  27 + <div class="caption">
  28 + <i class="icon-equalizer font-red-sunglo"></i> <span
  29 + class="caption-subject font-red-sunglo bold uppercase">表单</span>
  30 + </div>
  31 + </div>
  32 +
  33 + <div class="portlet-body form">
  34 + <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm">
  35 + <div class="form-body">
  36 + <div class="form-group has-success has-feedback">
  37 + <label class="col-md-2 control-label">所属公司*:</label>
  38 + <div class="col-md-3">
  39 + <div class="input-group">
  40 + <ui-select ng-model="ctrl.employeeInfoForSave.gs_selected"
  41 + on-select="ctrl.gs_selected_change($item, $model)"
  42 + theme="bootstrap" name="gs" required>
  43 + <ui-select-match placeholder="请选择所属公司...">{{$select.selected.gsmc}}</ui-select-match>
  44 + <ui-select-choices repeat="item in ctrl.gses">
  45 + <span ng-bind="item.gsmc"></span>
  46 + </ui-select-choices>
  47 + </ui-select>
  48 + <span class="input-group-btn">
  49 + <button type="button" ng-click="ctrl.gs_selected_remove()" class="btn btn-default">
  50 + <span class="glyphicon glyphicon-trash"></span>
  51 + </button>
  52 + </span>
  53 + </div>
  54 + </div>
  55 + <!-- 隐藏块,显示验证信息 -->
  56 + <div class="alert alert-danger well-sm" ng-show="myForm.gs.$error.required">
  57 + 公司必须选择
  58 + </div>
  59 + </div>
  60 +
  61 + <!-- TODO -->
  62 + <div class="form-group">
  63 + <label class="col-md-2 control-label">分公司:</label>
  64 + <div class="col-md-3">
  65 + <select name="brancheCompanyCode" class="form-control">
  66 + <option value="">请选择...</option>
  67 + <option value="1">分公司1</option>
  68 + <option value="2">分公司1</option>
  69 + <option value="3">分公司1</option>
  70 + <option value="4">分公司1</option>
  71 + </select>
  72 + </div>
  73 + </div>
  74 +
  75 + <div class="form-group has-success has-feedback">
  76 + <label class="col-md-2 control-label">工号*:</label>
  77 + <div class="col-md-3">
  78 + <input type="text" class="form-control"
  79 + name="jobCode" ng-model="ctrl.employeeInfoForSave.jobCode"
  80 + required placeholder="请输入工号"/>
  81 + </div>
  82 + <!-- 隐藏块,显示验证信息 -->
  83 + <div class="alert alert-danger well-sm" ng-show="myForm.jobCode.$error.required">
  84 + 工号必须填写
  85 + </div>
  86 + </div>
  87 +
  88 + <div class="form-group has-success has-feedback">
  89 + <label class="col-md-2 control-label">姓名*:</label>
  90 + <div class="col-md-3">
  91 + <input type="text" class="form-control"
  92 + name="personnelName" ng-model="ctrl.employeeInfoForSave.personnelName"
  93 + required placeholder="请输入姓名"/>
  94 + </div>
  95 + <!-- 隐藏块,显示验证信息 -->
  96 + <div class="alert alert-danger well-sm" ng-show="myForm.personnelName.$error.required">
  97 + 姓名必须填写
  98 + </div>
  99 + </div>
  100 +
  101 + <div class="form-group">
  102 + <label class="col-md-2 control-label">运营服务证书号:</label>
  103 + <div class="col-md-4">
  104 + <input type="text" class="form-control" ng-model="ctrl.employeeInfoForSave.papersCode"
  105 + placeholder="请输入运营服务证书号"/>
  106 + </div>
  107 + </div>
  108 +
  109 + <div class="form-group">
  110 + <label class="col-md-2 control-label">一卡通号:</label>
  111 + <div class="col-md-4">
  112 + <input type="text" class="form-control" ng-model="ctrl.employeeInfoForSave.icCardCode"
  113 + placeholder="请输入一卡通工作卡号"/>
  114 + </div>
  115 + </div>
  116 +
  117 + <div class="form-group">
  118 + <label class="col-md-2 control-label">性别:</label>
  119 + <div class="col-md-4">
  120 + <label class="radio-inline">
  121 + <input type="radio" name="personnelType"
  122 + ng-value="'男性'" ng-model="ctrl.employeeInfoForSave.personnelType"/>男性
  123 + </label>
  124 + <label class="radio-inline">
  125 + <input type="radio" name="personnelType"
  126 + ng-value="'女性'" ng-model="ctrl.employeeInfoForSave.personnelType"/>女性
  127 + </label>
  128 + </div>
  129 + </div>
  130 +
  131 + <div class="form-group">
  132 + <label class="col-md-2 control-label">工种:</label>
  133 + <div class="col-md-4">
  134 + <div class="input-group">
  135 + <ui-select ng-model="ctrl.employeeInfoForSave.posts_selected"
  136 + on-select="ctrl.posts_selected_change($item, $model)"
  137 + theme="bootstrap" name="posts">
  138 + <ui-select-match placeholder="请选择工种...">{{$select.selected.type}}</ui-select-match>
  139 + <ui-select-choices repeat="item in ctrl.postes">
  140 + <span ng-bind="item.type"></span>
  141 + </ui-select-choices>
  142 + </ui-select>
  143 + <span class="input-group-btn">
  144 + <button type="button" ng-click="ctrl.posts_selected_remove()" class="btn btn-default">
  145 + <span class="glyphicon glyphicon-trash"></span>
  146 + </button>
  147 + </span>
  148 + </div>
  149 + </div>
  150 + </div>
  151 +
  152 + <!-- 其他form-group -->
  153 +
  154 + </div>
  155 +
  156 + <div class="form-actions">
  157 + <div class="row">
  158 + <div class="col-md-offset-3 col-md-4">
  159 + <button type="submit" class="btn green" ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button>
  160 + <a type="button" class="btn default" ui-sref="employeeInfoManage" ><i class="fa fa-times"></i> 取消</a>
  161 + </div>
  162 + </div>
  163 + </div>
  164 +
  165 + </form>
  166 + </div>
  167 +
  168 +</div>
0 \ No newline at end of file 169 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/employeeInfoManage.js
1 // 人员信息管理 service controller等写在一起 1 // 人员信息管理 service controller等写在一起
2 2
3 -angular.module('ScheduleApp').factory('EmployeeInfoManageService', ['$resource', function($resource) {  
4 - // TODO:测试 3 +angular.module('ScheduleApp').factory('EmployeeInfoManageService', ['EmployeeInfoManageService_g', function(service) {
  4 + /** 公司字典 */
  5 + var gses = [
  6 + {gsdm: "55", gsmc: "上南公司"},
  7 + {gsdm: "22", gsmc: "金高公司"},
  8 + {gsdm: "05", gsmc: "杨高公司"},
  9 + {gsdm: "26", gsmc: "南汇公司"}
  10 + ];
  11 + /** 工种类型字典 */
  12 + var postes = [
  13 + {type: "公共汽电车驾驶员"},
  14 + {type: "公共汽电车调度员"},
  15 + {type: "公共汽电车售票员"},
  16 + {type: "站员"},
  17 + {type: "管理员"},
  18 + {type: "安检员"},
  19 + {type: "机务"},
  20 + {type: "引导员"},
  21 + {type: "乘务员"},
  22 + {type: "车队长(线长、主"},
  23 + {type: "公司管理人员"},
  24 + {type: "警消人员"},
  25 + {type: "票务人员"},
  26 + {type: "其他服务人员"}
  27 + ];
5 28
  29 + /** 当前的查询条件信息 */
  30 + var currentSearchCondition = {
  31 + //"carCode_like" : "",
  32 + //"insideCode_like" : "",
  33 + //"equipmentCode_like" : "",
  34 + //"carPlate_like" : ""
  35 + };
6 36
7 - return $resource(  
8 - '/cci',  
9 - {},  
10 - {  
11 - list: {  
12 - method: 'GET' 37 + /** 当前第几页 */
  38 + var currentPageNo = 1;
  39 +
  40 + return {
  41 + /**
  42 + * 获取公司字典。
  43 + */
  44 + getGses: function() {
  45 + return gses;
  46 + },
  47 + /**
  48 + * 获取工种类型字典。
  49 + */
  50 + getPostes: function() {
  51 + return postes;
  52 + },
  53 + /**
  54 + * 获取查询条件信息,
  55 + * 用于给controller用来和页面数据绑定。
  56 + */
  57 + getSearchCondition: function() {
  58 + return currentSearchCondition;
  59 + },
  60 + /**
  61 + * 重置查询条件信息。
  62 + */
  63 + resetSearchCondition: function() {
  64 + var key;
  65 + for (key in currentSearchCondition) {
  66 + currentSearchCondition[key] = "";
13 } 67 }
  68 + },
  69 + /**
  70 + * 设置当前页码。
  71 + * @param cpn 从1开始,后台是从0开始的
  72 + */
  73 + setCurrentPageNo: function(cpn) {
  74 + currentPageNo = cpn;
  75 + },
  76 + /**
  77 + * 组装查询参数,返回一个promise查询结果。
  78 + * @param params 查询参数
  79 + * @return 返回一个 promise
  80 + */
  81 + getPage: function() {
  82 + var params = currentSearchCondition; // 查询条件
  83 + params.page = currentPageNo - 1; // 服务端页码从0开始
  84 + return service.list(params).$promise;
  85 + },
  86 + /**
  87 + * 获取明细信息。
  88 + * @param id 车辆id
  89 + * @return 返回一个 promise
  90 + */
  91 + getDetail: function(id) {
  92 + var params = {id: id};
  93 + return service.get(params).$promise;
  94 + },
  95 + /**
  96 + * 保存信息。
  97 + * @param obj 车辆详细信息
  98 + * @return 返回一个 promise
  99 + */
  100 + saveDetail: function(obj) {
  101 + return service.save(obj).$promise;
14 } 102 }
15 - ); 103 + }
16 104
17 }]); 105 }]);
18 106
19 -angular.module('ScheduleApp').controller('EmployeeInfoManageCtrl', ['EmployeeInfoManageService', function(employeeInfoManageService) { 107 +angular.module('ScheduleApp').controller('EmployeeInfoManageCtrl', ['EmployeeInfoManageService', '$state', function(employeeInfoManageService, $state) {
  108 + var self = this;
20 109
  110 + // 切换到form状态
  111 + self.goForm = function() {
  112 + //alert("切换");
  113 + $state.go("deviceInfoManage_form");
  114 + }
21 }]); 115 }]);
22 116
23 angular.module('ScheduleApp').controller('EmployeeInfoManageListCtrl', ['EmployeeInfoManageService', function(employeeInfoManageService) { 117 angular.module('ScheduleApp').controller('EmployeeInfoManageListCtrl', ['EmployeeInfoManageService', function(employeeInfoManageService) {
24 - // TODO:模拟数据  
25 var self = this; 118 var self = this;
26 - self.totalItems = 64;  
27 - self.currentPage = 4;  
28 - self.infos = {}; 119 + self.pageInfo = {
  120 + totalItems : 0,
  121 + currentPage : 1,
  122 + infos: []
  123 + };
  124 +
  125 + // 初始创建的时候,获取一次列表数据
  126 + employeeInfoManageService.getPage().then(
  127 + function(result) {
  128 + self.pageInfo.totalItems = result.totalElements;
  129 + self.pageInfo.currentPage = result.number + 1;
  130 + self.pageInfo.infos = result.content;
  131 + employeeInfoManageService.setCurrentPageNo(result.number + 1);
  132 + },
  133 + function(result) {
  134 + alert("出错啦!");
  135 + }
  136 + );
  137 +
  138 + //$scope.$watch("ctrl.pageInfo.currentPage", function() {
  139 + // alert("dfdfdf");
  140 + //});
  141 +
  142 + // 翻页的时候调用
29 self.pageChanaged = function() { 143 self.pageChanaged = function() {
30 - console.log("页面跳转到:" + currentPage.currentPage);  
31 - } 144 + employeeInfoManageService.setCurrentPageNo(self.pageInfo.currentPage);
  145 + employeeInfoManageService.getPage().then(
  146 + function(result) {
  147 + self.pageInfo.totalItems = result.totalElements;
  148 + self.pageInfo.currentPage = result.number + 1;
  149 + self.pageInfo.infos = result.content;
  150 + employeeInfoManageService.setCurrentPageNo(result.number + 1);
  151 + },
  152 + function(result) {
  153 + alert("出错啦!");
  154 + }
  155 + );
  156 + };
  157 + // 获取查询条件数据
  158 + self.searchCondition = function() {
  159 + return employeeInfoManageService.getSearchCondition();
  160 + };
  161 + // 重置查询条件
  162 + self.resetSearchCondition = function() {
  163 + return employeeInfoManageService.resetSearchCondition();
  164 + };
32 }]); 165 }]);
33 166
34 -angular.module('ScheduleApp').controller('EmployeeInfoManageFormCtrl', ['EmployeeInfoManageService', function(employeeInfoManageService) { 167 +angular.module('ScheduleApp').controller('EmployeeInfoManageFormCtrl', ['EmployeeInfoManageService', '$stateParams', '$state', function(employeeInfoManageService, $stateParams, $state) {
  168 + var self = this;
  169 +
  170 + // 欲保存的busInfo信息,绑定
  171 + self.employeeInfoForSave = {};
  172 +
  173 + // 公司 selectedItem
  174 + self.employeeInfoForSave.gs_selected = null;
  175 + self.gses = employeeInfoManageService.getGses();
  176 + self.gs_selected_change = function($item, $model) {
  177 + self.employeeInfoForSave.companyCode = $item.gsdm;
  178 + self.employeeInfoForSave.company = $item.gsmc;
  179 + };
  180 + self.gs_selected_remove = function() {
  181 + self.employeeInfoForSave.gs_selected = null;
  182 + self.employeeInfoForSave.companyCode = null;
  183 + self.employeeInfoForSave.company = null;
  184 + };
  185 +
  186 + // 工种 selectedItem
  187 + self.employeeInfoForSave.posts_selected = null;
  188 + self.postes = employeeInfoManageService.getPostes();
  189 + self.posts_selected_change = function($item, $model) {
  190 + self.employeeInfoForSave.posts = $item.type;
  191 + };
  192 + self.posts_selected_remove = function() {
  193 + self.employeeInfoForSave.posts_selected = null;
  194 + self.employeeInfoForSave.posts = null;
  195 + };
  196 +
  197 + // 获取传过来的id,有的话就是修改,获取一遍数据
  198 + var id = $stateParams.id;
  199 + if (id) {
  200 + self.employeeInfoForSave.id = id;
  201 + employeeInfoManageService.getDetail(id).then(
  202 + function(result) {
  203 + var key;
  204 + for (key in result) {
  205 + self.employeeInfoForSave[key] = result[key];
  206 + }
  207 + // 填写所有的 select 控件选中框数据
  208 + // 公司字典
  209 + if (self.employeeInfoForSave.companyCode) {
  210 + angular.forEach(self.gses, function(data) {
  211 + if (self.employeeInfoForSave.companyCode == data.gsdm) {
  212 + self.employeeInfoForSave.gs_selected = data;
  213 + }
  214 + });
  215 + }
  216 + // 工种字典
  217 + if (self.employeeInfoForSave.posts) {
  218 + angular.forEach(self.postes, function(data) {
  219 + if (self.employeeInfoForSave.posts == data.type) {
  220 + self.employeeInfoForSave.posts_selected = data;
  221 + }
  222 + });
  223 + }
  224 +
  225 + },
  226 + function(result) {
  227 + alert("出错啦!");
  228 + }
  229 + );
  230 + }
  231 +
  232 + // 提交方法
  233 + self.submit = function() {
  234 + console.log(self.employeeInfoForSave);
  235 + employeeInfoManageService.saveDetail(self.employeeInfoForSave).then(
  236 + function(result) {
  237 + // TODO:弹出框方式以后改
  238 + if (result.status == 'SUCCESS') {
  239 + alert("保存成功!");
  240 + $state.go("employeeInfoManage");
  241 + } else {
  242 + alert("保存异常!");
  243 + }
  244 + },
  245 + function(result) {
  246 + // TODO:弹出框方式以后改
  247 + alert("出错啦!");
  248 + }
  249 + );
  250 + };
  251 +
35 252
36 }]); 253 }]);
37 254
38 -angular.module('ScheduleApp').controller('EmployeeInfoManageDetailCtrl', ['EmployeeInfoManageService', function(employeeInfoManageService) { 255 +angular.module('ScheduleApp').controller('EmployeeInfoManageDetailCtrl', ['EmployeeInfoManageService', '$stateParams', function(employeeInfoManageService, $stateParams) {
  256 + var self = this;
  257 + self.title = "";
  258 + self.employeeInfoForDetail = {};
  259 + self.employeeInfoForDetail.id = $stateParams.id;
39 260
  261 + // 当转向到此页面时,就获取明细信息并绑定
  262 + employeeInfoManageService.getDetail($stateParams.id).then(
  263 + function(result) {
  264 + var key;
  265 + for (key in result) {
  266 + self.employeeInfoForDetail[key] = result[key];
  267 + }
  268 +
  269 + self.title = "员工 " + self.employeeInfoForDetail.personnelName + " 详细信息";
  270 + },
  271 + function(result) {
  272 + // TODO:弹出框方式以后改
  273 + alert("出错啦!");
  274 + }
  275 + );
40 }]); 276 }]);
41 277
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/form.html
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>添加人员信息</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li>
  9 + <a href="/pages/home.html" data-pjax>首页</a>
  10 + <i class="fa fa-circle"></i>
  11 + </li>
  12 + <li>
  13 + <span class="active">基础信息</span>
  14 + <i class="fa fa-circle"></i>
  15 + </li>
  16 + <li>
  17 + <a ui-sref="employeeInfoManage">人员信息管理</a>
  18 + <i class="fa fa-circle"></i>
  19 + </li>
  20 + <li>
  21 + <span class="active">添加人员信息</span>
  22 + </li>
  23 +</ul>
  24 +
  25 +<div class="portlet light bordered" ng-controller="EmployeeInfoManageFormCtrl as ctrl">
  26 + <div class="portlet-title">
  27 + <div class="caption">
  28 + <i class="icon-equalizer font-red-sunglo"></i> <span
  29 + class="caption-subject font-red-sunglo bold uppercase">表单</span>
  30 + </div>
  31 + </div>
  32 +
  33 + <div class="portlet-body form">
  34 + <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm">
  35 + <div class="form-body">
  36 + <div class="form-group has-success has-feedback">
  37 + <label class="col-md-2 control-label">所属公司*:</label>
  38 + <div class="col-md-3">
  39 + <div class="input-group">
  40 + <ui-select ng-model="ctrl.employeeInfoForSave.gs_selected"
  41 + on-select="ctrl.gs_selected_change($item, $model)"
  42 + theme="bootstrap" name="gs" required>
  43 + <ui-select-match placeholder="请选择所属公司...">{{$select.selected.gsmc}}</ui-select-match>
  44 + <ui-select-choices repeat="item in ctrl.gses">
  45 + <span ng-bind="item.gsmc"></span>
  46 + </ui-select-choices>
  47 + </ui-select>
  48 + <span class="input-group-btn">
  49 + <button type="button" ng-click="ctrl.gs_selected_remove()" class="btn btn-default">
  50 + <span class="glyphicon glyphicon-trash"></span>
  51 + </button>
  52 + </span>
  53 + </div>
  54 + </div>
  55 + <!-- 隐藏块,显示验证信息 -->
  56 + <div class="alert alert-danger well-sm" ng-show="myForm.gs.$error.required">
  57 + 公司必须选择
  58 + </div>
  59 + </div>
  60 +
  61 + <!-- TODO -->
  62 + <div class="form-group">
  63 + <label class="col-md-2 control-label">分公司:</label>
  64 + <div class="col-md-3">
  65 + <select name="brancheCompanyCode" class="form-control">
  66 + <option value="">请选择...</option>
  67 + <option value="1">分公司1</option>
  68 + <option value="2">分公司1</option>
  69 + <option value="3">分公司1</option>
  70 + <option value="4">分公司1</option>
  71 + </select>
  72 + </div>
  73 + </div>
  74 +
  75 + <div class="form-group has-success has-feedback">
  76 + <label class="col-md-2 control-label">工号*:</label>
  77 + <div class="col-md-3">
  78 + <input type="text" class="form-control"
  79 + name="jobCode" ng-model="ctrl.employeeInfoForSave.jobCode"
  80 + required placeholder="请输入工号"/>
  81 + </div>
  82 + <!-- 隐藏块,显示验证信息 -->
  83 + <div class="alert alert-danger well-sm" ng-show="myForm.jobCode.$error.required">
  84 + 工号必须填写
  85 + </div>
  86 + </div>
  87 +
  88 + <div class="form-group has-success has-feedback">
  89 + <label class="col-md-2 control-label">姓名*:</label>
  90 + <div class="col-md-3">
  91 + <input type="text" class="form-control"
  92 + name="personnelName" ng-model="ctrl.employeeInfoForSave.personnelName"
  93 + required placeholder="请输入姓名"/>
  94 + </div>
  95 + <!-- 隐藏块,显示验证信息 -->
  96 + <div class="alert alert-danger well-sm" ng-show="myForm.personnelName.$error.required">
  97 + 姓名必须填写
  98 + </div>
  99 + </div>
  100 +
  101 + <div class="form-group">
  102 + <label class="col-md-2 control-label">运营服务证书号:</label>
  103 + <div class="col-md-4">
  104 + <input type="text" class="form-control" ng-model="ctrl.employeeInfoForSave.papersCode"
  105 + placeholder="请输入运营服务证书号"/>
  106 + </div>
  107 + </div>
  108 +
  109 + <div class="form-group">
  110 + <label class="col-md-2 control-label">一卡通号:</label>
  111 + <div class="col-md-4">
  112 + <input type="text" class="form-control" ng-model="ctrl.employeeInfoForSave.icCardCode"
  113 + placeholder="请输入一卡通工作卡号"/>
  114 + </div>
  115 + </div>
  116 +
  117 + <div class="form-group">
  118 + <label class="col-md-2 control-label">性别:</label>
  119 + <div class="col-md-4">
  120 + <label class="radio-inline">
  121 + <input type="radio" name="personnelType"
  122 + ng-value="'男性'" ng-model="ctrl.employeeInfoForSave.personnelType"/>男性
  123 + </label>
  124 + <label class="radio-inline">
  125 + <input type="radio" name="personnelType"
  126 + ng-value="'女性'" ng-model="ctrl.employeeInfoForSave.personnelType"/>女性
  127 + </label>
  128 + </div>
  129 + </div>
  130 +
  131 + <div class="form-group">
  132 + <label class="col-md-2 control-label">工种:</label>
  133 + <div class="col-md-4">
  134 + <div class="input-group">
  135 + <ui-select ng-model="ctrl.employeeInfoForSave.posts_selected"
  136 + on-select="ctrl.posts_selected_change($item, $model)"
  137 + theme="bootstrap" name="posts">
  138 + <ui-select-match placeholder="请选择工种...">{{$select.selected.type}}</ui-select-match>
  139 + <ui-select-choices repeat="item in ctrl.postes">
  140 + <span ng-bind="item.type"></span>
  141 + </ui-select-choices>
  142 + </ui-select>
  143 + <span class="input-group-btn">
  144 + <button type="button" ng-click="ctrl.posts_selected_remove()" class="btn btn-default">
  145 + <span class="glyphicon glyphicon-trash"></span>
  146 + </button>
  147 + </span>
  148 + </div>
  149 + </div>
  150 + </div>
  151 +
  152 + <!-- 其他form-group -->
  153 +
  154 + </div>
  155 +
  156 + <div class="form-actions">
  157 + <div class="row">
  158 + <div class="col-md-offset-3 col-md-4">
  159 + <button type="submit" class="btn green" ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button>
  160 + <a type="button" class="btn default" ui-sref="employeeInfoManage" ><i class="fa fa-times"></i> 取消</a>
  161 + </div>
  162 + </div>
  163 + </div>
  164 +
  165 + </form>
  166 + </div>
  167 +
  168 +</div>
0 \ No newline at end of file 169 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/index.html
@@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
27 <span class="caption-subject bold uppercase">人员信息表</span> 27 <span class="caption-subject bold uppercase">人员信息表</span>
28 </div> 28 </div>
29 <div class="actions"> 29 <div class="actions">
30 - <a href="javascirpt:" class="btn btn-circle blue"> 30 + <a href="javascirpt:" class="btn btn-circle blue" ng-click="ctrl.goForm()">
31 <i class="fa fa-plus"></i> 31 <i class="fa fa-plus"></i>
32 添加人员信息 32 添加人员信息
33 </a> 33 </a>
@@ -58,7 +58,7 @@ @@ -58,7 +58,7 @@
58 </div> 58 </div>
59 59
60 <div class="portlet-body"> 60 <div class="portlet-body">
61 - <div ui-view="list"></div> 61 + <div ui-view="employeeInfoManage_list"></div>
62 </div> 62 </div>
63 </div> 63 </div>
64 </div> 64 </div>
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/list.html
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <div ng-controller="EmployeeInfoManageListCtrl as ctrl"> 2 <div ng-controller="EmployeeInfoManageListCtrl as ctrl">
3 <table class="table table-striped table-bordered table-hover table-checkable order-column"> 3 <table class="table table-striped table-bordered table-hover table-checkable order-column">
4 <thead> 4 <thead>
5 - <tr> 5 + <tr role="row" class="heading">
6 <th> 6 <th>
7 <input type="checkbox" class="group-checkable"/> 7 <input type="checkbox" class="group-checkable"/>
8 </th> 8 </th>
@@ -16,16 +16,85 @@ @@ -16,16 +16,85 @@
16 <th>工种</th> 16 <th>工种</th>
17 <th>一卡通号</th> 17 <th>一卡通号</th>
18 <th>运营服务证号</th> 18 <th>运营服务证号</th>
19 - <th>操作</th> 19 + <th width="14%">操作</th>
  20 + </tr>
  21 + <tr role="row" class="filter">
  22 + <td></td>
  23 + <td></td>
  24 + <td>
  25 + <input type="text" class="form-control input-sm" ng-model="ctrl.searchCondition().personnelCode_like"/>
  26 + </td>
  27 + <td>
  28 + <input type="text" class="form-control input-sm" ng-model="ctrl.searchCondition().personnelName_like"/>
  29 + </td>
  30 + <td>
  31 + <input type="text" class="form-control input-sm" ng-model="ctrl.searchCondition().jobCode_like"/>
  32 + </td>
  33 + <td>
  34 + <select class="form-contrl form-filter">
  35 + <option value="">请选择</option>
  36 + <option value="男">男</option>
  37 + <option value="女">女</option>
  38 + </select>
  39 + </td>
  40 + <td>
  41 + <select class="form-control form-filter " >
  42 + <option value="">请选择...</option>
  43 + <option value="55">上南公司</option>
  44 + <option value="22">金高公司</option>
  45 + <option value="05">杨高公司</option>
  46 + <option value="26">南汇公司</option>
  47 + </select>
  48 + </td>
  49 + <td>
  50 + <select class="form-control form-filter " >
  51 + <option value="">请选择...</option>
  52 + </select>
  53 + </td>
  54 + <td>
  55 + <select class="form-control form-filter " >
  56 + <option value="">请选择...</option>
  57 + <option value="公共汽电车驾驶员">公共汽电车驾驶员</option>
  58 + <option value="公共汽电车调度员">公共汽电车调度员</option>
  59 + <option value="公共汽电车售票员">公共汽电车售票员</option>
  60 + <option value="站员">站员</option>
  61 + <option value="管理员">管理员</option>
  62 + <option value="安检员">安检员</option>
  63 + <option value="机务">机务</option>
  64 + <option value="引导员">引导员</option>
  65 + <option value="乘务员">乘务员</option>
  66 + <option value="车队长(线长、主">车队长(线长、主</option>
  67 + <option value="公司管理人员">公司管理人员</option>
  68 + <option value="警消人员">警消人员</option>
  69 + <option value="票务人员">票务人员</option>
  70 + <option value="其他服务人员">其他服务人员</option>
  71 + </select>
  72 + </td>
  73 + <td>
  74 + <input type="text" class="form-control input-sm" ng-model="ctrl.searchCondition().icCardCode_like"/>
  75 + </td>
  76 + <td>
  77 + <input type="text" class="form-control input-sm" ng-model="ctrl.searchCondition().papersCode_like"/>
  78 + </td>
  79 + <td>
  80 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
  81 + ng-click="ctrl.pageChanaged()">
  82 + <i class="fa fa-search"></i> 搜索</button>
  83 +
  84 + <button class="btn btn-sm red btn-outline filter-cancel"
  85 + ng-click="ctrl.resetSearchCondition()">
  86 + <i class="fa fa-times"></i> 重置</button>
  87 + </td>
  88 +
20 </tr> 89 </tr>
21 </thead> 90 </thead>
22 <tbody> 91 <tbody>
23 - <tr ng-repeat="info in ctrl.infos" class="odd gradeX"> 92 + <tr ng-repeat="info in ctrl.pageInfo.infos" class="odd gradeX">
24 <td> 93 <td>
25 <input type="checkbox"/> 94 <input type="checkbox"/>
26 </td> 95 </td>
27 <td> 96 <td>
28 - <span>TODO</span> 97 + <span ng-bind="$index + 1"></span>
29 </td> 98 </td>
30 <td> 99 <td>
31 <span ng-bind="info.personnelCode"></span> 100 <span ng-bind="info.personnelCode"></span>
@@ -46,7 +115,7 @@ @@ -46,7 +115,7 @@
46 <span ng-bind="info.brancheCompany"></span> 115 <span ng-bind="info.brancheCompany"></span>
47 </td> 116 </td>
48 <td> 117 <td>
49 - <span>TODO</span> 118 + <span ng-bind="info.posts"></span>
50 </td> 119 </td>
51 <td> 120 <td>
52 <span ng-bind="info.icCardCode"></span> 121 <span ng-bind="info.icCardCode"></span>
@@ -55,18 +124,26 @@ @@ -55,18 +124,26 @@
55 <span ng-bind="info.papersCode"></span> 124 <span ng-bind="info.papersCode"></span>
56 </td> 125 </td>
57 <td> 126 <td>
58 - <span>TODO</span> 127 + <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
  128 + <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
  129 + <a ui-sref="employeeInfoManage_detail({id: info.id})" class="btn default blue-stripe btn-sm"> 详细 </a>
  130 + <a ui-sref="employeeInfoManage_edit({id: info.id})" class="btn default blue-stripe btn-sm"> 修改 </a>
59 </td> 131 </td>
60 </tr> 132 </tr>
61 </tbody> 133 </tbody>
62 </table> 134 </table>
63 135
64 <div style="text-align: right;"> 136 <div style="text-align: right;">
65 - <uib-pagination total-items="ctrl.totalItems"  
66 - ng-model="ctrl.currentPage"  
67 - ng-change="ctrl.pageChanged()" 137 + <uib-pagination total-items="ctrl.pageInfo.totalItems"
  138 + ng-model="ctrl.pageInfo.currentPage"
  139 + ng-change="ctrl.pageChanaged()"
  140 + rotate="false"
  141 + max-size="10"
  142 + boundary-links="true"
  143 + first-text="首页"
68 previous-text="上一页" 144 previous-text="上一页"
69 - next-text="下一页"> 145 + next-text="下一页"
  146 + last-text="尾页">
70 </uib-pagination> 147 </uib-pagination>
71 </div> 148 </div>
72 </div> 149 </div>
73 \ No newline at end of file 150 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/main.js
@@ -131,7 +131,7 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi @@ -131,7 +131,7 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi
131 "": { 131 "": {
132 templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/index.html' 132 templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/index.html'
133 }, 133 },
134 - "list@employeeInfoManage": { 134 + "employeeInfoManage_list@employeeInfoManage": {
135 templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/list.html' 135 templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/list.html'
136 } 136 }
137 }, 137 },
@@ -148,6 +148,61 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi @@ -148,6 +148,61 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi
148 }] 148 }]
149 } 149 }
150 }) 150 })
  151 + .state("employeeInfoManage_form", {
  152 + url: '/employeeInfoManage_form',
  153 + views: {
  154 + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/form.html'}
  155 + },
  156 + resolve: {
  157 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  158 + return $ocLazyLoad.load({
  159 + name: 'employeeInfoManage_form_module',
  160 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  161 + files: [
  162 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  163 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  164 + "pages/scheduleApp/module/basicInfo/employeeInfoManage/employeeInfoManage.js"
  165 + ]
  166 + });
  167 + }]
  168 + }
  169 + })
  170 + .state("employeeInfoManage_edit", {
  171 + url: '/employeeInfoManage_edit/:id',
  172 + views: {
  173 + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/edit.html'}
  174 + },
  175 + resolve: {
  176 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  177 + return $ocLazyLoad.load({
  178 + name: 'employeeInfoManage_edit_module',
  179 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  180 + files: [
  181 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  182 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  183 + "pages/scheduleApp/module/basicInfo/employeeInfoManage/employeeInfoManage.js"
  184 + ]
  185 + });
  186 + }]
  187 + }
  188 + })
  189 + .state("employeeInfoManage_detail", {
  190 + url: '/employeeInfoManage_detail/:id',
  191 + views: {
  192 + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/employeeInfoManage/detail.html'}
  193 + },
  194 + resolve: {
  195 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  196 + return $ocLazyLoad.load({
  197 + name: 'employeeInfoManage_module',
  198 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  199 + files: [
  200 + "pages/scheduleApp/module/basicInfo/employeeInfoManage/employeeInfoManage.js"
  201 + ]
  202 + });
  203 + }]
  204 + }
  205 + })
151 206
152 // 车辆设备信息模块配置 207 // 车辆设备信息模块配置
153 .state("deviceInfoManage", { 208 .state("deviceInfoManage", {
@@ -156,7 +211,7 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi @@ -156,7 +211,7 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi
156 "": { 211 "": {
157 templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/index.html' 212 templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/index.html'
158 }, 213 },
159 - "list@deviceInfoManage": { 214 + "deviceInfoManage_list@deviceInfoManage": {
160 templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/list.html' 215 templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/list.html'
161 } 216 }
162 }, 217 },
@@ -173,6 +228,68 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi @@ -173,6 +228,68 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi
173 }] 228 }]
174 } 229 }
175 }) 230 })
  231 + .state("deviceInfoManage_form", {
  232 + url: '/deviceInfoManage_form',
  233 + views: {
  234 + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/form.html'}
  235 + },
  236 + resolve: {
  237 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  238 + return $ocLazyLoad.load({
  239 + name: 'deviceInfoManage_form_module',
  240 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  241 + files: [
  242 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  243 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  244 + "pages/scheduleApp/module/basicInfo/deviceInfoManage/deviceInfoManage.js"
  245 + ]
  246 + });
  247 + }]
  248 + }
  249 + })
  250 + .state("deviceInfoManage_edit", {
  251 + url: '/deviceInfoManage_edit/:id',
  252 + views: {
  253 + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/edit.html'}
  254 + },
  255 + resolve: {
  256 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  257 + return $ocLazyLoad.load({
  258 + name: 'deviceInfoManage_edit_module',
  259 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  260 + files: [
  261 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  262 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  263 + "pages/scheduleApp/module/basicInfo/deviceInfoManage/deviceInfoManage.js"
  264 + ]
  265 + });
  266 + }]
  267 + }
  268 + })
  269 + .state("deviceInfoManage_detail", {
  270 + url: '/deviceInfoManage_detail/:id',
  271 + views: {
  272 + "": {templateUrl: 'pages/scheduleApp/module/basicInfo/deviceInfoManage/detail.html'}
  273 + },
  274 + resolve: {
  275 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  276 + return $ocLazyLoad.load({
  277 + name: 'deviceInfoManage_module',
  278 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  279 + files: [
  280 + "pages/scheduleApp/module/basicInfo/deviceInfoManage/deviceInfoManage.js"
  281 + ]
  282 + });
  283 + }]
  284 + }
  285 + })
  286 +
  287 +
  288 +
  289 +
  290 +
  291 +
  292 +
176 293
177 // 车辆配置模块 294 // 车辆配置模块
178 .state("busConfig", { 295 .state("busConfig", {
@@ -273,6 +390,48 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;BusInfoManageService_g&#39;, [&#39;$resource&#39;, fu @@ -273,6 +390,48 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;BusInfoManageService_g&#39;, [&#39;$resource&#39;, fu
273 } 390 }
274 ); 391 );
275 }]); 392 }]);
  393 +// 人员信息service
  394 +angular.module('ScheduleApp').factory('EmployeeInfoManageService_g', ['$resource', function($resource) {
  395 + return $resource(
  396 + '/personnel/:id',
  397 + {order: 'jobCode', direction: 'ASC', id: '@id_route'},
  398 + {
  399 + list: {
  400 + method: 'GET',
  401 + params: {
  402 + page: 0
  403 + }
  404 + },
  405 + get: {
  406 + method: 'GET'
  407 + },
  408 + save: {
  409 + method: 'POST'
  410 + }
  411 + }
  412 + );
  413 +}]);
  414 +// 车辆设备信息service
  415 +angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) {
  416 + return $resource(
  417 + '/carDevice/:id',
  418 + {order: 'createDate', direction: 'DESC', id: '@id_route'},
  419 + {
  420 + list: {
  421 + method: 'GET',
  422 + params: {
  423 + page: 0
  424 + }
  425 + },
  426 + get: {
  427 + method: 'GET'
  428 + },
  429 + save: {
  430 + method: 'POST'
  431 + }
  432 + }
  433 + );
  434 +}]);
276 435
277 436
278 437
src/test/java/com/bsth/service/schedule/rules/DroolsRulesTest.java 0 → 100644
  1 +package com.bsth.service.schedule.rules;
  2 +
  3 +import com.bsth.Application;
  4 +import org.junit.Test;
  5 +import org.junit.runner.RunWith;
  6 +import org.kie.api.KieBase;
  7 +import org.kie.api.runtime.KieSession;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.boot.test.SpringApplicationConfiguration;
  10 +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
  11 +
  12 +import java.util.ArrayList;
  13 +import java.util.List;
  14 +
  15 +@RunWith(SpringJUnit4ClassRunner.class)
  16 +@SpringApplicationConfiguration(classes = {Application.class})
  17 +public class DroolsRulesTest {
  18 +
  19 + @Autowired
  20 + private KieBase kieBase;
  21 +
  22 + @Test
  23 + public void helloWorldDrlTest() throws Exception {
  24 + // 1、创建session,内部配置的是stateful
  25 + KieSession session = kieBase.newKieSession();
  26 +
  27 + // 1.1 设置gloable对象,在drl中通过别名使用
  28 + List<String> gloableList = new ArrayList<String>();
  29 + session.setGlobal("list", gloableList);
  30 +
  31 + // 1.2 可以设置一些监听器,再议
  32 +
  33 + // 2、创建fact对象
  34 + Message message = new Message();
  35 + message.setMessage("Hello World");
  36 + message.setStatus(Message.HELLO);
  37 + session.insert(message);
  38 +
  39 + // 3、执行rule
  40 + session.fireAllRules();
  41 +
  42 + System.out.println(gloableList);
  43 +
  44 + // 4、执行完毕销毁,有日志的也要关闭
  45 + session.dispose();
  46 + }
  47 +}
src/test/resources/.gitkeep 0 → 100644