Просмотр исходного кода

修改bug,添加其他稽查页面

minitiger 8 лет назад
Родитель
Сommit
377a500070
33 измененных файлов с 618 добавлено и 235 удалено
  1. 1 0
      VisualInspection/js/assess_management/assess_item.js
  2. 92 30
      VisualInspection/js/assess_management/assess_way.js
  3. 2 0
      VisualInspection/js/lib/treeSelect.js
  4. 2 0
      VisualInspection/js/main.js
  5. 1 1
      VisualInspection/js/mytask/check.js
  6. 68 32
      VisualInspection/js/other_check/other_check.js
  7. 153 117
      VisualInspection/js/role/role.js
  8. 24 14
      VisualInspection/js/statistics/common_statistic.js
  9. 4 4
      VisualInspection/js/user/addUser.js
  10. 39 0
      VisualInspection/js/util/util.js
  11. 31 4
      VisualInspection/view/assess_management/assess_way.html
  12. 3 3
      VisualInspection/view/role/role.html
  13. 4 0
      VisualInspection_server/src/main/java/com/xintong/visualinspection/bean/CheckRule.java
  14. 11 0
      VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/CheckItemController.java
  15. 24 1
      VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/CheckRuleController.java
  16. 13 0
      VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/DepartmentController.java
  17. 1 1
      VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/RoleController.java
  18. 11 0
      VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/UserController.java
  19. 2 0
      VisualInspection_server/src/main/java/com/xintong/visualinspection/dao/cluster/DepartmentDao.java
  20. 2 0
      VisualInspection_server/src/main/java/com/xintong/visualinspection/dao/master/CheckItemDao.java
  21. 3 0
      VisualInspection_server/src/main/java/com/xintong/visualinspection/dao/master/CheckRuleDao.java
  22. 11 0
      VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/cluster/DepartmentMapper.xml
  23. 3 2
      VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/cluster/UserInfoMapper.xml
  24. 15 0
      VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/master/CheckItemMapper.xml
  25. 18 2
      VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/master/CheckRuleMapper.xml
  26. 2 0
      VisualInspection_server/src/main/java/com/xintong/visualinspection/service/CheckItemService.java
  27. 2 0
      VisualInspection_server/src/main/java/com/xintong/visualinspection/service/CheckRuleService.java
  28. 3 0
      VisualInspection_server/src/main/java/com/xintong/visualinspection/service/DepartmentService.java
  29. 1 0
      VisualInspection_server/src/main/java/com/xintong/visualinspection/service/UserService.java
  30. 9 2
      VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/CheckItemServiceImpl.java
  31. 42 18
      VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/CheckRuleServiceImpl.java
  32. 7 4
      VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/DepartmentServiceImpl.java
  33. 14 0
      VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/UserServiceImpl.java

+ 1 - 0
VisualInspection/js/assess_management/assess_item.js

@@ -353,6 +353,7 @@ function loadData(nodedata) {
 }
 
 
+
 function addCheckItem() {
     //获取名称
     var name = $("#check_item_name").val();

+ 92 - 30
VisualInspection/js/assess_management/assess_way.js

@@ -9,32 +9,80 @@ function queryTable(){
     var cols = [
                     {width: 30, text: '序号', flex: false, colClass: 'text-center',field:'num'},
                     {width: 160, text: '考核办法', flex: false,colClass: 'text-center',field:'name'},
-                    {width: 80, text: '被考核部门',  flex: true, colClass: 'text-center',field:'checked_dept_name'},
-                    {width: 100, text: '被考核职位',  flex: true, colClass: 'text-center',field:'checked_position_name'},
+                    // {width: 80, text: '被考核部门',  flex: true, colClass: 'text-center',field:'checked_dept_name'},
+                    // {width: 100, text: '被考核职位',  flex: true, colClass: 'text-center',field:'checked_position_name'},
+                    {width: 80, text: '类型',  flex: false, colClass: 'text-center',field:'rule_type_name'},
                     {width: 100, text: '考核项',  flex: false, type: 'string',colClass: 'text-center modity-flag',field:'checked_item_num' },
                     {width: 80, text: '操作',  flex: false, colClass: 'text-center',field:'id',oper:[
+                         {func:'showEditRule',text:'编辑',col_class:'icon-remove-circle'},
                          {func:'deleteCheckRule',text:'删除',col_class:'icon-remove-circle'}
                     ]},
                 ] ;
     
-    $('.datatable').mytable({'cols':cols,
+    $('#ruleDatatable').mytable({'cols':cols,
                             'url':"/checkRule/getAllRule/",
                             'param':data}
                             );
      $('#addModal').modal('hide');
+
+}
+
+function setRuleTypeSelect(div, selectId) {
+    post_common_service("/constant/getConstantByFlag", {code_flag: "rule_type"}, function(data) {
+        var optStr = '<option value="">无</option>';
+        for (var i in data) {
+            if (data[i].code_value == selectId)
+                optStr += '<option value="' + data[i].code_value + '" selected="selected">' + data[i].code_name + '</option>';
+            else
+                optStr += '<option value="' + data[i].code_value + '">' + data[i].code_name + '</option>';
+        }
+        $(div).html('');
+        $(div).html(optStr);
+    });
 }
 
 // 删除
 function deleteCheckRule(id){
     deleteItem4Common(id,"/checkRule/delete/",queryTable);
 }
+// function addOrUpdateConstant(url){
+//     var valid=1;
+//     if(!$("#valid").is(':checked')) valid=0;
+//     var param ={
+//         'id':cur_id,
+//         'code_flag':$('#code_flag').val(),
+//         'flag_name':$('#flag_name').val(),
+//         'code_value':Number($('#code_value').val()),
+//         'code_name':$('#code_name').val(),
+//         'sort_no':Number($('#sort_no').val()),
+//         'remark':$('#remark').val(),
+//         'valid':valid
+//     };
+//     addOrUpdateItem4Common(param,url,queryConstant);
+// }
+
+function showEditRule(id){
+    cur_id='';
+    var rowData=getItemByIdFromArr(id,$('#ruleDatatable').mytable('getTableData'));
+    if(rowData) {
+        cur_id = rowData.id;
+        $('#check_rule_name').val(rowData.name);
+        $('#rule_type').val(rowData.rule_type);
+        // alert(rowData);
+        showPopup4Common('修改考核办法',function(){
+            addOrUpdateCheckRule("/checkRule/update/");
+        },'400px','#edit-rule-div');
+        setRuleTypeSelect("#rule_type", rowData.rule_type);
+    }
+}
 
 function showAddCheckRule(){
-    $('#check_rule_name,#dep_id,#position_id').val('');
-    // showPopup4Common('添加考核办法',function(){
-    //    return addOrUpdateCheckRule("/checkRule/add");
-    // },'400px');
-     $('#addModal').modal('show');
+    $('#check_rule_name').val('');
+    showPopup4Common('添加考核办法',function(){
+        return addOrUpdateCheckRule("/checkRule/add");
+    },'400px','#edit-rule-div');
+    setRuleTypeSelect("#rule_type", null);
+    // $('#addModal').modal('show');
 }
 
 var all_data = [];
@@ -115,26 +163,40 @@ function getJob(dept_id){
 /**
  * 添加考核办法 - 保存
  */
-function addOrUpdateCheckRule(){
-    if(idVal("check_rule_name") == ''){
-        tip("请输入考核办法");
-        return false;
-    }
-    if(idVal("position_id") == ''){
-        tip("请选择职位");
-        return false;
-    }
-    if(dept_selectinput.value==null || dept_selectinput.value==''){
-        tip("请选择部门信息");
-        return false ;
-    }
-    var param ={
-        "name":idVal("check_rule_name") ,
-        "checked_dept_id":dept_selectinput.value,
-        "checked_position_id":idVal("position_id"),
-        "checked_person_type":1
-    };
-    addOrUpdateItem4Common(param,"/checkRule/add",queryTable);
+function addOrUpdateCheckRule(url){
+
+    layer.confirm('相同类型的考核办法只能保留一条,可能会影响到之前数据,是否确定保存?', {
+        btn: ['是', '否'], //按钮
+        shadeClose: true,
+    }, function() {
+        if(idVal("check_rule_name") == ''){
+            tip("请输入考核办法");
+            return false;
+        }
+        // if(idVal("rule_type") == ''){
+        //     tip("请选择类型");
+        //     return false;
+        // }
+        // if(idVal("position_id") == ''){
+        //     tip("请选择职位");
+        //     return false;
+        // }
+        // if(dept_selectinput.value==null || dept_selectinput.value==''){
+        //     tip("请选择部门信息");
+        //     return false ;
+        // }
+        var param ={
+            "name":idVal("check_rule_name") ,
+            "rule_type":idVal("rule_type"),
+            "id":cur_id
+            // "checked_dept_id":dept_selectinput.value,
+            // "checked_position_id":idVal("position_id"),
+            // "checked_person_type":1
+        };
+        addOrUpdateItem4Common(param,url,queryTable);
+    }, function() {
+
+    });
 }
 
 function idVal(id){
@@ -149,8 +211,8 @@ $(document).ready(function() {
     queryTable();
 
     // 考核项链接
-    $(".datatable").delegate("td.modity-flag","click",function(){
-        var obj = $('.datatable').data("data_cache")[$(this).attr("data-row")] ;
+    $("#ruleDatatable").delegate("td.modity-flag","click",function(){
+        var obj = $('#ruleDatatable').data("data_cache")[$(this).attr("data-row")] ;
         $.zui.store.set("check_rule_id",obj.id);
         $.zui.store.set("check_rule_name",obj.name);
         changePage("/view/assess_management/assess_way_edit.html");

+ 2 - 0
VisualInspection/js/lib/treeSelect.js

@@ -61,6 +61,7 @@ var TreeSelect = (function() {
                      return;
                  }
             }
+            
             if (!self.isOpen()) {
                 self.open();
             } else {
@@ -132,6 +133,7 @@ var TreeSelect = (function() {
                 opacity: 1
             });
             panel.show();
+            //先去掉遮罩,tree为空导致遮罩无法关闭 by pan
             self.mask = $('<div class="treeSelect-mask"></div>');
             $('body').append(self.mask);
             self.mask.click(function() {

+ 2 - 0
VisualInspection/js/main.js

@@ -105,6 +105,8 @@ $(document).ready(function() {
         //首先要获取任务列表页面的下拉参数,然后才能显示页面
         //加载道管中心列表
         getRoadManagerList();
+        //加载清障大队列表
+        getWreckerGroupList();
         getFeeList(function(data1) {
             getFeePersonList(function(data3) {
                 getJobList(function(data2) {

+ 1 - 1
VisualInspection/js/mytask/check.js

@@ -845,7 +845,7 @@ function getCheckItems() {
         }
     };
 
-    get_common_service('checkItem/getAll', null, function(data) {
+    post_common_service('checkRule/getItemListByRuleType', {rule_type:1}, function(data) {
         console.log(data);
         zdata = [];
         for (var i = 0; i < data.length; i++) {

+ 68 - 32
VisualInspection/js/other_check/other_check.js

@@ -34,27 +34,28 @@ var al_data = [];
             zIndex:300000000000// 分隔符可以任意定义,该例子表示只显示年月日
         });
         var road_manager;
-        if (roleContains("STATION")) {
+        if (roleContains("STATION")||roleContains("WRECKER")) {
             road_manager = getCurrentUser().road_manager_id;
         }
         if (roleContains("ROAD_MANAGER")) {
             road_manager = getCurrentUser().organid;
         }
-        setRoadManagerSelect("#first", road_manager);
+        setRoadManagerSelect("#first", road_manager, true);
         setSecond();
 
         // 收费站下拉框
         var dept;
-        if (roleContains("STATION")) {
+        if (roleContains("STATION")||roleContains("WRECKER")) {
             dept = getCurrentUser().organid;
         }
         var roadManager2;
         if (roleContains("ROAD_MANAGER")) {
             roadManager2 = getCurrentUser().organid;
         }
-        var feeList = $.zui.store.get("cache_fee_station_list");
-        if (roadManager2) feeList = cache_road_manager_fee_list_map.get(roadManager2);
-        setFeeSelectValueNoAll(feeList, "#select-dept", dept);
+        //var feeList = $.zui.store.get("cache_fee_station_list");
+        //if (roadManager2) feeList = cache_road_manager_fee_list_map.get(roadManager2);
+        var feeList = getOrganList(roadManager2);
+        setFeeSelectValue(feeList, "#select-dept", dept);
         setPersonal();
         var zTreeObj;
         var zNodes = [];
@@ -303,7 +304,7 @@ function refreshUploader(){
     });
 }
  function setVisit() {
-        if (roleContains("STATION")) {
+        if (roleContains("STATION")||roleContains("WRECKER")) {
             $("#first").attr("disabled", "disabled");
             $("#second").attr("disabled", "disabled");
         }
@@ -319,20 +320,35 @@ function refreshUploader(){
         flag = true;
     });
 
+    function getOrganList(select_road){
+        var organList;
+        if (select_road) {
+            if(check_type==5){
+                organList = cache_road_manager_wrecker_group_map.get(select_road);
+            }else{
+                organList = cache_road_manager_fee_list_map.get(select_road);
+            }
+        }else{
+            if(check_type==5){
+                organList = $.zui.store.get("cache_wrecker_group_list");
+            }else{
+                organList = $.zui.store.get("cache_fee_station_list");
+            }
+        }
+        return organList;
+    }
     function setSecond() {
         var select_road = $(".div-roadManage select").val();
-        var feeList = $.zui.store.get("cache_fee_station_list");
-        if (select_road) feeList = cache_road_manager_fee_list_map.get(select_road);
-
+        var feeList = getOrganList(select_road);
         var dept;
-        if (roleContains("STATION")) {
+        if (roleContains("STATION")||roleContains("WRECKER")) {
             dept = getCurrentUser().organid;
         }
         refreshFee(feeList, dept);
     }
     function refreshFee(data, selectId) {
         var sec = document.getElementById('second');
-        var tempStr = ''
+        var tempStr = '<option value="">全部</option>'
         if (data.length != 0) {
             for (var i = 0; i < data.length; i++) {
                 if (data[i].deptid == selectId)
@@ -357,22 +373,28 @@ function refreshUploader(){
         var param = {
             "organid": select_road
         }
-        post_common_service("user/getFsUserList", param, function(data) {
+        var url = "user/getFsUserList";
+        if(check_type==5){
+            url = "user/getWGUserList";
+        }
+        post_common_service(url, param, function(data) {
+            console.log(data);
             if (data.length != 0) {
                 var userId;
                 if (hasRole("ROLE_STATION")) {
                     userId = getCurrentUser().id;
                 }
+                console.log(data);
                 for (var i = 0; i < data.length; i++) {
-                    for (var j = 33; j <= 53; j++) {
-                        if (select_road == j) {
+                    // for (var j = 33; j <= 53; j++) {
+                        // if (select_road == j) {
                             if (data[i].id == userId) {
                                 tempStr += "<option value=" + data[i].id + " selected='selected'>" + data[i].truename + "</option>";
                             } else {
                                 tempStr += "<option value=" + data[i].id + ">" + data[i].truename + "</option>";
                             }
-                        }
-                    }
+                        // }
+                    // }
                     sec.innerHTML = tempStr;
                 }
             } else {
@@ -547,23 +569,37 @@ function refreshUploader(){
          }
      };
 
-     post_common_service("/checkItem/getAll","",function(data){
+     var param = {};
+     if(check_type==1){
+        param.rule_type=2;
+     }else if(check_type==2){
+        param.rule_type=3;
+     }else if(check_type==3){
+        param.rule_type=4;
+     }else if(check_type==4){
+        param.rule_type=5;
+     }else if(check_type==5){
+        param.rule_type=6;
+     }
+     post_common_service('checkRule/getItemListByRuleType', param,function(data){
         all_data = [];
         z_cache = data ;
-         for (var i = 0; i < data.length; i++) {
-             var m = data[i];
-             var zdataItem = {};
-             zdataItem["id"] = m.id;
-             zdataItem["value"] = m.id;
-             zdataItem["pId"] = null;
-             zdataItem["score"] = m.score ;
-             zdataItem["name"] = m.name;
-             zdataItem["open"] = true;
-             zdataItem["children"] = addobj(m);
-              zdataItem.open = true ;
-             all_data.push(zdataItem);
-         }
-         check_item_tree = $.fn.zTree.init($("#check_rule_tree2"), setting, all_data)
+        if(data){
+            for (var i = 0; i < data.length; i++) {
+                 var m = data[i];
+                 var zdataItem = {};
+                 zdataItem["id"] = m.id;
+                 zdataItem["value"] = m.id;
+                 zdataItem["pId"] = null;
+                 zdataItem["score"] = m.score ;
+                 zdataItem["name"] = m.name;
+                 zdataItem["open"] = true;
+                 zdataItem["children"] = addobj(m);
+                  zdataItem.open = true ;
+                 all_data.push(zdataItem);
+            }
+            check_item_tree = $.fn.zTree.init($("#check_rule_tree2"), setting, all_data)
+        }
      },function(error){})
  }
 

+ 153 - 117
VisualInspection/js/role/role.js

@@ -4,12 +4,14 @@ var cols = [{
     type: 'number',
     flex: true,
     colClass: 'text-center'
+    ,field: 'num'
 }, {
     width: 'auto',
     text: '角色名称',
     type: 'string',
     flex: true,
     colClass: 'text-center'
+    ,field: 'des'
 },
 {
     width: 'auto',
@@ -17,18 +19,26 @@ var cols = [{
     type: 'number',
     flex: true,
     colClass: 'text-center'
+    ,field: 'level'
 }, {
     width: 'auto',
     text: '用户数',
     type: 'number',
     flex: true,
     colClass: 'text-center'
+    ,field: 'usercount'
 }, {
     width: 'auto',
     text: '操作',
     type: 'string',
     flex: true,
     colClass: 'text-center'
+    ,field: 'id',
+    oper:[
+        {func:'eidtRole',text:'修改',icon_class:'icon-edit'},
+        {func:'deleteRole',text:'删除',icon_class:'icon-remove-circle'}
+        // '<button class="btn btn-primary" name="user_edit" id=' + role.id + '><i class="icon icon-edit"></i>修改</button>  <button class="btn btn-primary" name="user_delete" id=' + role.id + ' ><i class="icon icon-remove-circle"></i>删除</button>'
+    ]
 }];
 var pageNo = null;
 var edittype = "add";
@@ -38,50 +48,50 @@ $(document).ready(function () {
 
     // $("#main_content_title").html("角色管理")
 
-    $('.datatable').datatable({
-        checkable: false,
-        sortable: false,
-        data: {
-            cols: cols,
-            rows: []
-        }
-    });
-
-
-    $('.datatable').on('click', 'button', function () {
-        if (this.name == "user_edit") {
-
-            edittype = "edit"
-            loadRoleData(RoleMap.get(parseInt(this.id)));
-
-            $('#addRoleModal').modal('show');
-        }
-        if (this.name == "user_delete") {
-            var roleId = this.id;
-            deleteItem4CallBack(function(){
-                RoleDelete(roleId, function (data) {
-                    getrole(pagesize, 1);
-                    layer.msg('角色删除成功!', {
-                        time: 2000, //20s后自动关闭
-                    }, function () {
-                    });
-                },
-                function (error) {
-
-                })
-            });           
-        }
-    });
-
-
-    if (pageNo == null || pageNo == "") {
-        getrole(pagesize, 1);
-    } else {
-        getrole(pagesize, pageNo);
-    }
-
-
-
+    // $('.datatable').datatable({
+    //     checkable: false,
+    //     sortable: false,
+    //     data: {
+    //         cols: cols,
+    //         rows: []
+    //     }
+    // });
+
+
+    // $('.datatable').on('click', 'button', function () {
+    //     if (this.name == "user_edit") {
+
+    //         edittype = "edit"
+    //         loadRoleData(getItemByIdFromArr(id,$('#task_list_table').mytable('getTableData')););
+
+    //         $('#addRoleModal').modal('show');
+    //     }
+    //     if (this.name == "user_delete") {
+    //         var roleId = this.id;
+    //         deleteItem4CallBack(function(){
+    //             RoleDelete(roleId, function (data) {
+    //                 getrole(pagesize, 1);
+    //                 layer.msg('角色删除成功!', {
+    //                     time: 2000, //20s后自动关闭
+    //                 }, function () {
+    //                 });
+    //             },
+    //             function (error) {
+
+    //             })
+    //         });           
+    //     }
+    // });
+
+
+    // if (pageNo == null || pageNo == "") {
+    //     getrole(pagesize, 1);
+    // } else {
+    //     getrole(pagesize, pageNo);
+    // }
+
+
+    getrole();
     $("#add_role_btn").on("click", function () {
         edittype = "add";
         loadRoleData(null);
@@ -90,82 +100,108 @@ $(document).ready(function () {
 
 });
 
+function eidtRole(id){
+    edittype = "edit"
+    loadRoleData(getItemByIdFromArr(id,$('#role_datatable').mytable('getTableData')));
+
+    $('#addRoleModal').modal('show');
+}
 
-function getrole(size, page) {
-    RoleGetALL(page, size, function (data) {
-
-        totalPage = data.pages;
-        totalRecords = data.total;
-        setpage(data.currentPage);
-        var rowdata = [];
-        if (data.list.length > 0) {
-            for (var i = 0; i < data.list.length; i++) {
-                var role = data.list[i];
-                var userdata = {};
-                userdata["checked"] = false;
-                userdata["data"] = [i + 1, role.des,role.level, role.usercount, '<button class="btn btn-primary" name="user_edit" id=' + role.id + '><i class="icon icon-edit"></i>修改</button>  <button class="btn btn-primary" name="user_delete" id=' + role.id + ' ><i class="icon icon-remove-circle"></i>删除</button>'];
-                rowdata.push(userdata);
-                RoleMap.set(role.id,role);
-            }
-        }
+function deleteRole(id){
+    var roleId = id;
+    deleteItem4CallBack(function(){
+        RoleDelete(roleId, function (data) {
+            getrole();
+            layer.msg('角色删除成功!', {
+                time: 2000, //20s后自动关闭
+            }, function () {
+            });
+        },
+        function (error) {
+
+        })
+    });     
+}
+
+function getrole() {
+    // RoleGetALL(page, size, function (data) {
+
+    //     totalPage = data.pages;
+    //     totalRecords = data.total;
+    //     setpage(data.currentPage);
+    //     var rowdata = [];
+    //     if (data.list.length > 0) {
+    //         for (var i = 0; i < data.list.length; i++) {
+    //             var role = data.list[i];
+    //             var userdata = {};
+    //             userdata["checked"] = false;
+    //             userdata["data"] = [i + 1, role.des,role.level, role.usercount, '<button class="btn btn-primary" name="user_edit" id=' + role.id + '><i class="icon icon-edit"></i>修改</button>  <button class="btn btn-primary" name="user_delete" id=' + role.id + ' ><i class="icon icon-remove-circle"></i>删除</button>'];
+    //             rowdata.push(userdata);
+    //             RoleMap.set(role.id,role);
+    //         }
+    //     }
        
 
-        // 使用data参数更新数据:
-        $('.datatable').datatable('load', {
-            cols: cols,
-            rows: rowdata
-        });
-    }, function (error) {
+    //     // 使用data参数更新数据:
+    //     $('.datatable').datatable('load', {
+    //         cols: cols,
+    //         rows: rowdata
+    //     });
+    // }, function (error) {
+
+    // });
 
-    });
+    taskTableObj = $('#role_datatable').mytable({'cols':cols,
+    'url':ROLE_GET_ALL_DATA
+     });
 }
 
-var totalPage = 20;
-var totalRecords = 390;
-function setpage(currentpage) {
-    if (!pageNo) {
-        pageNo = currentpage;
-    }
-
-    //生成分页
-    //有些参数是可选的,比如lang,若不传有默认值
-    kkpager.generPageHtml({
-        pno: pageNo,
-        //总页码
-        total: totalPage,
-        //总数据条数
-        totalRecords: totalRecords,
-        mode: 'click',//默认值是link,可选link或者click
-        click: function (n) {
-            // do something
-            getrole(pagesize, n);
-
-            //手动选中按钮
-            this.selectPage(n);
-            return false;
-        }
-        /*
-         ,lang				: {
-         firstPageText			: '首页',
-         firstPageTipText		: '首页',
-         lastPageText			: '尾页',
-         lastPageTipText			: '尾页',
-         prePageText				: '上一页',
-         prePageTipText			: '上一页',
-         nextPageText			: '下一页',
-         nextPageTipText			: '下一页',
-         totalPageBeforeText		: '共',
-         totalPageAfterText		: '页',
-         currPageBeforeText		: '当前第',
-         currPageAfterText		: '页',
-         totalInfoSplitStr		: '/',
-         totalRecordsBeforeText	: '共',
-         totalRecordsAfterText	: '条数据',
-         gopageBeforeText		: ' 转到',
-         gopageButtonOkText		: '确定',
-         gopageAfterText			: '页',
-         buttonTipBeforeText		: '第',
-         buttonTipAfterText		: '页'
-         }*/
-    });
-}
+// var totalPage = 20;
+// var totalRecords = 390;
+// function setpage(currentpage) {
+//     if (!pageNo) {
+//         pageNo = currentpage;
+//     }
+
+//     //生成分页
+//     //有些参数是可选的,比如lang,若不传有默认值
+//     kkpager.generPageHtml({
+//         pno: pageNo,
+//         //总页码
+//         total: totalPage,
+//         //总数据条数
+//         totalRecords: totalRecords,
+//         mode: 'click',//默认值是link,可选link或者click
+//         click: function (n) {
+//             // do something
+//             getrole(pagesize, n);
+
+//             //手动选中按钮
+//             this.selectPage(n);
+//             return false;
+//         }
+//         /*
+//          ,lang				: {
+//          firstPageText			: '首页',
+//          firstPageTipText		: '首页',
+//          lastPageText			: '尾页',
+//          lastPageTipText			: '尾页',
+//          prePageText				: '上一页',
+//          prePageTipText			: '上一页',
+//          nextPageText			: '下一页',
+//          nextPageTipText			: '下一页',
+//          totalPageBeforeText		: '共',
+//          totalPageAfterText		: '页',
+//          currPageBeforeText		: '当前第',
+//          currPageAfterText		: '页',
+//          totalInfoSplitStr		: '/',
+//          totalRecordsBeforeText	: '共',
+//          totalRecordsAfterText	: '条数据',
+//          gopageBeforeText		: ' 转到',
+//          gopageButtonOkText		: '确定',
+//          gopageAfterText			: '页',
+//          buttonTipBeforeText		: '第',
+//          buttonTipAfterText		: '页'
+//          }*/
+//     });
+// }

+ 24 - 14
VisualInspection/js/statistics/common_statistic.js

@@ -77,21 +77,31 @@ function getFsEmployee(fs_station_id , func, selectId){
  * return: String select 下 List<Option>
  */
 function getFsStationList(center_manage_id,func,hasAll){ 
-    var param = {
-            "parentid":center_manage_id
-    }
-    post_common_service("dept/getDeptInfosByDeptId",param,function(data){
-        var str = '';
-        if(data.length > 0){
-            str = "<option value=''>全部</option>";
-            if(hasAll==false) str="";
-            for(var i=0;i<data.length;i++){
-                str += "<option value="+data[i].id+">"+data[i].organname+"</option>";  
-            }
+    // var param = {
+    //         "parentid":center_manage_id
+    // }
+    // post_common_service("dept/getDeptInfosByDeptId",param,function(data){
+    //     var str = '';
+    //     if(data.length > 0){
+    //         str = "<option value=''>全部</option>";
+    //         if(hasAll==false) str="";
+    //         for(var i=0;i<data.length;i++){
+    //             str += "<option value="+data[i].id+">"+data[i].organname+"</option>";  
+    //         }
+    //     }
+    //    func(str);
+    // },function(error){
+    // });
+    var data = cache_road_manager_fee_list_map.get(center_manage_id);
+    var str = '';
+    if(data.length > 0){
+        str = "<option value=''>全部</option>";
+        if(hasAll==false) str="";
+        for(var i=0;i<data.length;i++){
+            str += "<option value="+data[i].deptid+">"+data[i].name+"</option>";  
         }
-       func(str);
-    },function(error){
-    });
+    }
+    func(str);
 }
 
 /**

+ 4 - 4
VisualInspection/js/user/addUser.js

@@ -5,7 +5,7 @@ var role_selectinput;
 
 function loadUserData(nodedata) {
     var pnode = nodedata;
-    resetform()
+    resetform();
 
     var enable = true;
 
@@ -35,10 +35,10 @@ function loadUserData(nodedata) {
 
     if (!enable) {
         role_selectinput.unbind();
-        $("#user_role_select").attr("disabled", true)
+        $("#user_role_select").attr("disabled", true);
     } else {
-        $("#user_role_select").attr("disabled", false)
-        role_selectinput.bindings()
+        $("#user_role_select").attr("disabled", false);
+        role_selectinput.bindings();
     }
 
     $(".ComboTreeItemChlid").find("input").prop('checked', false);

+ 39 - 0
VisualInspection/js/util/util.js

@@ -269,6 +269,45 @@ function setFeeSelectValueNoAll(data, div, selectId) {
     $(div).html(optStr);
 }
 
+var cache_road_manager_wrecker_group_map;
+function getWreckerGroupList(callback) {
+    get_common_service("/dept/getAllWG", null, function(data) {
+        $.zui.store.set("cache_wrecker_group_list", data);
+        var map = new Map();
+        for (var i = 0; i < data.length; i++) {
+            if (!map.get(data[i].parentid)) {
+                map.put(data[i].parentid, []);
+            }
+            var arr = map.get(data[i].parentid);
+            arr.push(data[i]);
+        }
+        cache_road_manager_wrecker_group_map = map;
+        if (callback) callback(data);
+    });
+}
+
+function setWreckerGroupSelect(div, selectId) {
+    var feeList = $.zui.store.get("cache_wrecker_group_list");
+    if (feeList) {
+        setWreckerGroupSelectValue(feeList, div, selectId);
+    } else {
+        get_common_service("/dept/getAllWG", null, function(data) {
+            setWreckerGroupSelectValue(data, div, selectId);
+        });
+    }
+}
+
+function setWreckerGroupSelectValue(data, div, selectId) {
+    var optStr = '<option value="">全部</option>';
+    for (var i in data) {
+        if (data[i].deptid == selectId)
+            optStr += '<option value="' + data[i].deptid + '" selected="selected">' + data[i].name + '</option>';
+        else
+            optStr += '<option value="' + data[i].deptid + '">' + data[i].name + '</option>';
+    }
+    $(div).html('');
+    $(div).html(optStr);
+}
 function setLaneSelect(div, selectId) {
     var optStr = '';
     var data = [];

+ 31 - 4
VisualInspection/view/assess_management/assess_way.html

@@ -25,12 +25,12 @@
 
             <div class="row">
                 <!-- 使用一个div来显示数据表格 -->
-                <div class="datatable" data-checkable="false" data-sortable="false"></div>
+                <div class="datatable" id="ruleDatatable" data-checkable="false" data-sortable="false"></div>
             </div>
           
         </div>
 
-        <div class="modal fade" id="addModal">
+        <!-- <div class="modal fade" id="addModal">
             <div class="modal-dialog">
                 <div class="modal-content">
                     <div class="modal-header">
@@ -48,6 +48,14 @@
                                         </div>
                                     </div>
                                     <div class="form-group">
+                                        <label for="exampleInputPassword4" class="col-sm-2">考核类型</label>
+                                        <div class="col-md-3 col-sm-3">
+                                            <select type="text" id="rule_type" class="form-control" >
+                                                <option value="" selected>请选择</option>
+                                            </select>
+                                        </div>
+                                    </div>
+                                    <div class="form-group">
                                         <label for="exampleInputPassword4" class="col-sm-2">考核对象</label>
                                         <div class="col-md-5 col-sm-5">
                                             <div id="check_item_select"></div>
@@ -69,8 +77,27 @@
                     </div>
                 </div>
             </div>
-        </div>
-
+        </div> -->
+<div id="edit-rule-div" style="display:none;text-align:center;">
+    <div class="container-fluid">
+        <form class="form-horizontal" style="margin-top:10px;">
+            <input type="hidden" class="form-control" id="apply_id" disabled="disabled" placeholder="">
+            <div class="form-group">
+                <label for="exampleInputAccount1" class="col-md-4 col-sm-2">名称</label>
+                <div class="col-md-6 col-sm-10">
+                    <input type="text" class="form-control" id="check_rule_name" placeholder="">
+                </div>
+            </div>
+            <div class="form-group">
+                <label for="exampleInputAccount1" class="col-md-4 col-sm-2">类型</label>
+                <div class="col-md-6 col-sm-10">
+                    <select type="text" id="rule_type" class="form-control" >
+                    </select>
+                </div>
+            </div>
+        </form>
+    </div>
+</div>
 <script src="/js/assess_management/assess_way.js?_inline"></script>
 <script type="text/javascript" src="/node_modules/zui/dist/lib/dashboard/zui.dashboard.min.js"></script>
 <link rel="stylesheet" type="text/css" href="/node_modules/zui/dist/lib/dashboard/zui.dashboard.min.css">

+ 3 - 3
VisualInspection/view/role/role.html

@@ -12,11 +12,11 @@
         </div>
     </div>
     <div class="row" style="padding-top:10px">
-        <div class="datatable" style="border: 1px solid #ddd" data-checkable="true" data-sortable="true"></div>
+        <div id="role_datatable" data-checkable="true" data-sortable="true"></div>
     </div>
-     <div class="row" style="padding-top:8px">
+     <!-- <div class="row" style="padding-top:8px">
          <div id='kkpager'></div>
-     </div>
+     </div> -->
 
 </div>
 

+ 4 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/bean/CheckRule.java

@@ -30,4 +30,8 @@ public class CheckRule {
     
     // 被考核的职位名称
     private String checked_position_name;
+    // 考核办法类型
+    private String rule_type;
+    // 考核办法类型
+    private String rule_type_name;
 }

+ 11 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/CheckItemController.java

@@ -1,6 +1,8 @@
 package com.xintong.visualinspection.controller;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import javax.validation.Valid;
 
@@ -11,6 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import com.xintong.system.err.BusinessException;
 import com.xintong.visualinspection.bean.CheckItem;
+import com.xintong.visualinspection.bean.CheckRule;
 import com.xintong.visualinspection.service.CheckItemService;
 
 /**
@@ -121,4 +124,12 @@ public class CheckItemController extends BaseController {
     	List<CheckItem> checkItemList = checkItemService.getByRuleId(checkItem.getRule_id());
     	return super.returnSuccessResult(checkItemList);
     }
+    
+    @RequestMapping(value = "/getCheckItemByRuleType")
+    public String getCheckItemByRuleType(@RequestBody CheckRule checkRule){
+    	Map<String,String> param = new HashMap<String,String>();
+    	param.put("rule_type", checkRule.getRule_type());
+    	List<CheckItem> checkItems =  checkItemService.getCheckItemByRuleType(param) ;
+    	return super.returnSuccessResult(checkItems);
+    }
 }

+ 24 - 1
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/CheckRuleController.java

@@ -1,6 +1,8 @@
 package com.xintong.visualinspection.controller;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import javax.validation.Valid;
 
@@ -14,8 +16,8 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.mysql.jdbc.StringUtils;
 import com.xintong.system.err.BusinessException;
+import com.xintong.visualinspection.bean.CheckItem;
 import com.xintong.visualinspection.bean.CheckRule;
-import com.xintong.visualinspection.bean.Constant;
 import com.xintong.visualinspection.service.CheckRuleService;
 
 /**
@@ -121,6 +123,27 @@ public class CheckRuleController extends BaseController {
     }
     
     /**
+     * 通过id获取考核项List
+     * @return
+     * String
+     * @exception
+     * @since
+     */
+    @RequestMapping(value = "/getItemListByRuleType")
+    public String getItemListByRuleType(@RequestBody CheckRule checkRule){
+    	if(checkRule.getRule_type()==null){
+    		throw new BusinessException(20002);
+    	}
+    	Map<String,String> param = new HashMap<String,String>();
+    	param.put("rule_type", checkRule.getRule_type());
+    	CheckRule cr = checkRuleService.getItemListByRuleType(param);
+    	List<CheckItem> itemList=null;
+    	if(cr!=null)
+    		itemList = cr.getCheck_items();
+    	return super.returnSuccessResult(itemList);
+    }
+    
+    /**
      * 通过名称获取考核办法
      * @return
      * String

+ 13 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/DepartmentController.java

@@ -15,6 +15,7 @@ import com.xintong.system.err.BusinessException;
 import com.xintong.visualinspection.bean.FeeStation;
 import com.xintong.visualinspection.bean.Organ;
 import com.xintong.visualinspection.bean.User;
+import com.xintong.visualinspection.bean.WreckerGroup;
 import com.xintong.visualinspection.service.DepartmentService;
 import com.xintong.visualinspection.util.CacheUtil;
 
@@ -154,6 +155,18 @@ public class DepartmentController extends BaseController {
     	List<FeeStation> organs = departmentService.getAllRM();
     	return returnResult(0, "获取成功", organs);
     }
+    /**
+     * 获取所有排障大队
+     * @return
+     * String
+     * @exception
+     * @since  1.0.0
+     */
+    @RequestMapping(value = "/getAllWG",method=RequestMethod.GET,produces="application/json;charset=UTF-8")
+    public String getAllWG(){
+    	List<WreckerGroup> organs = departmentService.getAllWG();
+    	return returnResult(0, "获取成功", organs);
+    }
     
     @RequestMapping(value = "/getFsByDept",method=RequestMethod.GET,produces="application/json;charset=UTF-8")
     public String getAFsByDeptId(HttpServletRequest request){

+ 1 - 1
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/RoleController.java

@@ -111,7 +111,7 @@ public class RoleController extends BaseController {
 	 * @param size
 	 * @return
 	 */
-	@RequestMapping(value = "/get/alldata/{page}/{size}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
+	@RequestMapping(value = "/get/alldata/{page}/{size}", produces = "application/json;charset=UTF-8")
 	public String getAllRoleData(@PathVariable Integer page, @PathVariable Integer size) {
 		try {
 			PageHelper.startPage(page, size);

+ 11 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/UserController.java

@@ -210,4 +210,15 @@ public class UserController extends BaseController {
         	throw new BusinessException(20001);
         }
     }
+    
+    @RequestMapping(value = "/getWGUserList",method=RequestMethod.POST,produces="application/json;charset=UTF-8")
+    public String getWGUserList(@RequestBody User user){
+        try{
+        	List<User> users= userService.getWGUserByDeptId(user);
+        	
+        	return returnResult(0, "获取成功", users);
+        }catch(Exception e){
+        	throw new BusinessException(20001);
+        }
+    }
 }

+ 2 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/dao/cluster/DepartmentDao.java

@@ -8,6 +8,7 @@ import com.xintong.visualinspection.bean.FeeStation;
 import com.xintong.visualinspection.bean.Organ;
 import com.xintong.visualinspection.bean.StatisticsBean;
 import com.xintong.visualinspection.bean.User;
+import com.xintong.visualinspection.bean.WreckerGroup;
 
 /**
  * 文件名:UserInfoDao
@@ -22,6 +23,7 @@ public interface DepartmentDao  {
     public void delete(Integer id);
     public List<FeeStation> getAllFS();
     public List<FeeStation> getAllRM();
+    public List<WreckerGroup> getAllWG();
     public FeeStation getFsBydeptId(Integer id);
     
     public List<StatisticsBean> selectFeeStationGroup(User obj);

+ 2 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/dao/master/CheckItemDao.java

@@ -1,6 +1,7 @@
 package com.xintong.visualinspection.dao.master;
 
 import java.util.List;
+import java.util.Map;
 
 import org.apache.ibatis.annotations.Mapper;
 
@@ -18,4 +19,5 @@ public interface CheckItemDao  {
     public void insert(CheckItem checkItem);
     public void update(CheckItem checkItem);
     public void delete(Long id);
+    public List<CheckItem> getCheckItemByRuleType(Map<String,String> param);
 }

+ 3 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/dao/master/CheckRuleDao.java

@@ -1,6 +1,7 @@
 package com.xintong.visualinspection.dao.master;
 
 import java.util.List;
+import java.util.Map;
 
 import org.apache.ibatis.annotations.Mapper;
 
@@ -20,7 +21,9 @@ public interface CheckRuleDao  {
     public void insert(CheckRule checkRule);
     public void insertRuleItem(List<CheckItem> checkItems);
     public void update(CheckRule checkRule);
+    public void updateRuleType(CheckRule checkRule);
     public void delete(Long id);
     public void deleteRuleItem(Long id);
     public Long getLastId();
+    public CheckRule getByRuleType(Map<String,String> param);
 }

+ 11 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/cluster/DepartmentMapper.xml

@@ -24,6 +24,13 @@
         <result column="organ_id" property="deptid" jdbcType="VARCHAR" />
         <result column="parentid" property="parentid" jdbcType="INTEGER" />
     </resultMap>
+    <resultMap id="WreckerGroupMap" type="com.xintong.visualinspection.bean.WreckerGroup" >
+        <id column="id" property="id" jdbcType="INTEGER" />
+        <result column="name" property="name" jdbcType="VARCHAR" />
+        <result column="organ_id" property="deptid" jdbcType="VARCHAR" />
+        <result column="parentid" property="parentid" jdbcType="INTEGER" />
+    </resultMap>
+    
     <select id="getAll" resultMap="BaseResultMap"  >
         SELECT * 
         FROM t_sys_organ
@@ -43,6 +50,10 @@
         SELECT *, b.parentid FROM t_br_layer_road_manager a left join t_sys_organ b on a.organ_id=b.id
     </select>
     
+     <select id="getAllWG" resultMap="FeeStationMap">
+        SELECT *, b.parentid FROM t_br_layer_wrecker_group a left join t_sys_organ b on a.organ_id=b.id
+    </select>
+    
     <select id="getFsBydeptId" parameterType="java.lang.Integer" resultMap="FeeStationMap">
         SELECT * FROM t_br_layer_fee_station where organ_id = #{id}
     </select>

+ 3 - 2
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/cluster/UserInfoMapper.xml

@@ -134,8 +134,9 @@
     
     <select id="getUsers" parameterType="com.xintong.visualinspection.bean.User" resultMap="BaseResultMapByInvalid"  >
         SELECT
-        t.* , fs.name AS fee_station_name,tso.parentid AS parent_organid ,deleted_user.starttime AS invalidtime
-        FROM t_sys_users t LEFT JOIN t_br_layer_fee_station fs ON t.organid = fs.organ_id
+        t.* , tso.organname AS fee_station_name,tso.parentid AS parent_organid ,deleted_user.starttime AS invalidtime
+        FROM t_sys_users t 
+        <!-- LEFT JOIN t_br_layer_fee_station fs ON t.organid = fs.organ_id -->
         LEFT JOIN t_sys_organ tso ON t.organid = tso.id
         LEFT JOIN  (select t_s_y.id,date_sub(t_p.starttime,interval 1 hour) as starttime from t_sys_users t_s_y
         LEFT join (select starttime,endtime from check_task_period ) t_p on DELETE_TIME &gt;= starttime and DELETE_TIME &lt; endtime

+ 15 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/master/CheckItemMapper.xml

@@ -56,4 +56,19 @@
         WHERE
         id =#{id}
     </delete>
+    
+    <select id="getCheckItemByRuleType" parameterType="map" resultMap="BaseResultMap"  >
+        SELECT *
+        FROM check_item
+        WHERE id in (
+        			select item_id
+        			from check_rule_item
+        			where rule_id = (
+        								select id
+        								from check_rule
+        								where rule_type=#{rule_type}
+        							)
+        			)
+        ORDER BY parent_id ASC , id ASC
+    </select>
 </mapper>

+ 18 - 2
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/master/CheckRuleMapper.xml

@@ -9,6 +9,7 @@
         <result column="checked_position_id" property="checked_position_id" jdbcType="INTEGER" />
         <result column="checked_position_name" property="checked_position_name" jdbcType="VARCHAR" />
         <result column="checked_dept_id" property="checked_dept_id" jdbcType="INTEGER" />
+        <result column="rule_type" property="rule_type" jdbcType="INTEGER"/>
         <collection property="check_items" ofType="com.xintong.visualinspection.bean.CheckItem"  
         	javaType="ArrayList">
         	<id property="id"  column="i_id"/>
@@ -52,9 +53,9 @@
     <insert id="insert" parameterType="com.xintong.visualinspection.bean.CheckRule" >
         INSERT INTO
         check_rule
-        (name,checked_person_type,checked_position_id,checked_dept_id)
+        (name,checked_person_type,checked_position_id,checked_dept_id,rule_type)
         VALUES
-        (#{name}, #{checked_person_type},#{checked_position_id},#{checked_dept_id})
+        (#{name}, #{checked_person_type},#{checked_position_id},#{checked_dept_id},#{rule_type})
     </insert>
 	
 	<insert id="insertRuleItem" parameterType="List" >
@@ -74,10 +75,19 @@
         <if test="checked_person_type != null">checked_person_type = #{checked_person_type},</if>
         <if test="checked_position_id != null">checked_position_id = #{checked_position_id},</if>
         <if test="checked_dept_id != null">checked_dept_id = #{checked_dept_id}</if>
+        <if test="rule_type != null">rule_type = #{rule_type}</if>
         WHERE
         id = #{id}
     </update>
     
+    <update id="updateRuleType" parameterType="com.xintong.visualinspection.bean.CheckRule" >
+        UPDATE
+        check_rule
+        SET rule_type = null
+        WHERE
+        rule_type = #{rule_type}
+    </update>
+    
     <delete id="deleteRuleItem" parameterType="java.lang.Long" >
         DELETE FROM
         	check_rule_item
@@ -91,4 +101,10 @@
         WHERE
         id =#{id}
     </delete>
+    
+    <select id="getByRuleType"  parameterType="map" resultMap="BaseResultMap"  >
+        SELECT *
+        FROM check_rule
+        WHERE rule_type = #{rule_type}
+    </select>
 </mapper>

+ 2 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/CheckItemService.java

@@ -1,6 +1,7 @@
 package com.xintong.visualinspection.service;
 
 import java.util.List;
+import java.util.Map;
 
 import com.xintong.visualinspection.bean.CheckItem;
 
@@ -24,4 +25,5 @@ public interface CheckItemService {
     public void insert(CheckItem checkItem);
     public void update(CheckItem checkItem);
     public void delete(Long id);
+    public List<CheckItem> getCheckItemByRuleType(Map<String,String> param);
 }

+ 2 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/CheckRuleService.java

@@ -1,6 +1,7 @@
 package com.xintong.visualinspection.service;
 
 import java.util.List;
+import java.util.Map;
 
 import com.xintong.visualinspection.bean.CheckRule;
 import com.xintong.visualinspection.bean.Constant;
@@ -26,4 +27,5 @@ public interface CheckRuleService {
     public void insert(CheckRule checkRule);
     public void update(CheckRule checkRule);
     public void delete(Long id);
+    public CheckRule getItemListByRuleType(Map<String,String> param);
 }

+ 3 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/DepartmentService.java

@@ -5,6 +5,7 @@ import java.util.List;
 import com.xintong.visualinspection.bean.FeeStation;
 import com.xintong.visualinspection.bean.Organ;
 import com.xintong.visualinspection.bean.User;
+import com.xintong.visualinspection.bean.WreckerGroup;
 
 /**
  * 文件名:UserService 版本信息:日期:2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
@@ -24,6 +25,8 @@ public interface DepartmentService {
 	
 	public List<FeeStation> getAllRM();
 	
+	public List<WreckerGroup> getAllWG();
+	
 	public FeeStation getFSByDeptId(Integer dept_id);
 	
 	// 根据条件获取公司下道管或者收费站信息

+ 1 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/UserService.java

@@ -22,4 +22,5 @@ public interface UserService extends UserDetailsService {
     public int queryCountByJob(User user);
     public List<User> getAllCheckmans();
     public List<User> getFsUserByDeptId(User user);
+    public List<User> getWGUserByDeptId(User user);
 }

+ 9 - 2
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/CheckItemServiceImpl.java

@@ -57,9 +57,9 @@ public class CheckItemServiceImpl extends BaseService implements CheckItemServic
 		// 找出子
 		for (Long oid : map.keySet()) {
 			for (CheckItem m2 : checkItems) {
-				if (m2.getId() == oid) {
+				if (m2.getId().longValue() == oid.longValue()) {
 					m2.setSubCheckItem(map.get(oid));
-					if (m2.getParent_id() == null || m2.getParent_id()==0) {
+					if (m2.getParent_id() == null || m2.getParent_id()==0L) {
 						olist.add(m2);
 					}
 				}
@@ -108,4 +108,11 @@ public class CheckItemServiceImpl extends BaseService implements CheckItemServic
 		// TODO Auto-generated method stub
 		return null;
 	}
+
+
+	@Override
+	public List<CheckItem> getCheckItemByRuleType(Map<String,String> param) {
+		// TODO Auto-generated method stub
+		return checkItemDao.getCheckItemByRuleType(param);
+	}
 }

+ 42 - 18
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/CheckRuleServiceImpl.java

@@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import com.mysql.jdbc.StringUtils;
 import com.xintong.visualinspection.bean.CheckItem;
 import com.xintong.visualinspection.bean.CheckRule;
 import com.xintong.visualinspection.bean.Organ;
@@ -18,6 +19,7 @@ import com.xintong.visualinspection.dao.master.CheckRuleDao;
 import com.xintong.visualinspection.service.BaseService;
 import com.xintong.visualinspection.service.CheckRuleService;
 import com.xintong.visualinspection.util.CacheUtil;
+import com.xintong.visualinspection.util.CodeUtil;
 
 /**
  * 文件名:UserServiceImpl
@@ -70,7 +72,7 @@ public class CheckRuleServiceImpl extends BaseService implements CheckRuleServic
 	private void getMyParent(CheckItem checkItem,List<CheckItem> lists,Map<Long,CheckItem> map ){
 		if(checkItem.getParent_id() !=null && checkItem.getParent_id()!=0){
 			for(CheckItem obj : lists){
-				if(checkItem.getParent_id() == obj.getId()){
+				if(checkItem.getParent_id().longValue() == obj.getId().longValue()){
 					// 判断这个有没有父亲了
 					if(obj.getParent_id()!=null){
 						getMyParent(obj,lists,map);
@@ -107,7 +109,7 @@ public class CheckRuleServiceImpl extends BaseService implements CheckRuleServic
 		// 找出子
 		for (Long oid : map.keySet()) {
 			for (CheckItem m2 : checkItems) {
-				if (m2.getId() == oid) {
+				if (m2.getId().longValue() == oid.longValue()) {
 					m2.setSubCheckItem(map.get(oid));
 					if (m2.getParent_id() == null || m2.getParent_id()==0) {
 						olist.add(m2);
@@ -121,34 +123,45 @@ public class CheckRuleServiceImpl extends BaseService implements CheckRuleServic
 	@Override
 	public List<CheckRule> getByName(String name) {
 		// TODO Auto-generated method stub
+		List<CheckRule> rules =checkRuleDao.getByName(name);
+		for(CheckRule r:rules){
+			r.setRule_type_name(CodeUtil.getCodeNameByFlagAndValue("rule_type", r.getRule_type()));
+		}
 		return checkRuleDao.getByName(name);
 	}
 
 	@Override
 	public void insert(CheckRule checkRule) {
 		// TODO Auto-generated method stub
-		checkRuleDao.insert(checkRule);
-		if(checkRule.getCheck_items()!=null && checkRule.getCheck_items().size()>0) {
-			Long id = checkRuleDao.getLastId();
-			for(CheckItem item:checkRule.getCheck_items()){
-				item.setRule_id(id);
-			}
-			checkRuleDao.insertRuleItem(checkRule.getCheck_items());
+		//如果需要设置rultType,需把表中有相同ruleType的字段置为空,保证ruleType的唯一性
+		if(checkRule.getRule_type()!=null){
+			checkRuleDao.updateRuleType(checkRule);
 		}
+		checkRuleDao.insert(checkRule);
+//		if(checkRule.getCheck_items()!=null && checkRule.getCheck_items().size()>0) {
+//			Long id = checkRuleDao.getLastId();
+//			for(CheckItem item:checkRule.getCheck_items()){
+//				item.setRule_id(id);
+//			}
+//			checkRuleDao.insertRuleItem(checkRule.getCheck_items());
+//		}
 	}
 
 	@Override
 	public void update(CheckRule checkRule) {
-		// TODO Auto-generated method stub
-		checkRuleDao.update(checkRule);
-		checkRuleDao.deleteRuleItem(checkRule.getId());
-		if(checkRule.getCheck_items()!=null && checkRule.getCheck_items().size()>0) {
-			Long id = checkRule.getId();
-			for(CheckItem item:checkRule.getCheck_items()){
-				item.setRule_id(id);
-			}
-			checkRuleDao.insertRuleItem(checkRule.getCheck_items());
+		//如果需要设置rultType,需把表中有相同ruleType的字段置为空,保证ruleType的唯一性
+		if(checkRule.getRule_type()!=null){
+			checkRuleDao.updateRuleType(checkRule);
 		}
+		checkRuleDao.update(checkRule);
+//		checkRuleDao.deleteRuleItem(checkRule.getId());
+//		if(checkRule.getCheck_items()!=null && checkRule.getCheck_items().size()>0) {
+//			Long id = checkRule.getId();
+//			for(CheckItem item:checkRule.getCheck_items()){
+//				item.setRule_id(id);
+//			}
+//			checkRuleDao.insertRuleItem(checkRule.getCheck_items());
+//		}
 	}
 
 	@Override
@@ -169,7 +182,18 @@ public class CheckRuleServiceImpl extends BaseService implements CheckRuleServic
 				}
 				
 			}
+			c.setRule_type_name(CodeUtil.getCodeNameByFlagAndValue("rule_type", c.getRule_type()));
 		}
 		return  lists;
 	}
+
+	@Override
+	public CheckRule getItemListByRuleType(Map<String, String> param) {
+		// TODO Auto-generated method stub
+		CheckRule rule = checkRuleDao.getByRuleType(param);
+		if(rule!=null){
+			return getListById(rule.getId());
+		}
+		return null;
+	}
 }

+ 7 - 4
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/DepartmentServiceImpl.java

@@ -10,17 +10,14 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.xintong.visualinspection.bean.FeeStation;
-import com.xintong.visualinspection.bean.Menu;
 import com.xintong.visualinspection.bean.Organ;
-import com.xintong.visualinspection.bean.Permission;
 import com.xintong.visualinspection.bean.Role;
 import com.xintong.visualinspection.bean.User;
+import com.xintong.visualinspection.bean.WreckerGroup;
 import com.xintong.visualinspection.dao.cluster.DepartmentDao;
 import com.xintong.visualinspection.service.BaseService;
 import com.xintong.visualinspection.service.DepartmentService;
 
-import lombok.Data;
-
 /**
  * 文件名:UserServiceImpl 版本信息:日期:2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017
  * 版权所有.
@@ -154,4 +151,10 @@ public class DepartmentServiceImpl extends BaseService implements DepartmentServ
 		return departmentDao.getAllRM();
 	}
 
+	@Override
+	public List<WreckerGroup> getAllWG() {
+		// TODO Auto-generated method stub
+		return departmentDao.getAllWG();
+	}
+
 }

+ 14 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/UserServiceImpl.java

@@ -162,4 +162,18 @@ public class UserServiceImpl extends BaseService implements UserService {
 		user.setPosition_ids(positionList);
 		return userInfoDao.getUsers(user);
 	}
+
+	@Override
+	public List<User> getWGUserByDeptId(User user) {
+		Constant t =  CodeUtil.getCodeByFlagAndValue("wrecker_group_check_jobs", "1");
+		
+		String[] postions = t.getCode_name().split(",");
+		List<Integer> positionList = new ArrayList<Integer>();
+		for(int i =0 ;i<postions.length;i++){
+			positionList.add(Integer.parseInt(postions[i]));
+		}
+
+		user.setPosition_ids(positionList);
+		return userInfoDao.getUsers(user);
+	}
 }