Преглед изворни кода

BUG对应

git-svn-id: https://192.168.57.71/svn/jsgkj@1230 931142cf-59ea-a443-aa0e-51397b428577
ld_zhouk пре 8 година
родитељ
комит
0b301fe852

+ 12 - 1
gkaqv2/trunk/modules/web/src/main/java/com/xt/js/gkaq/web/ctl/GroupCtl.java

@@ -3,6 +3,8 @@ package com.xt.js.gkaq.web.ctl;
 import java.io.UnsupportedEncodingException;
 import java.util.List;
 
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.subject.Subject;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -13,12 +15,14 @@ import org.springframework.web.bind.annotation.ResponseBody;
 
 import com.alibaba.fastjson.JSONArray;
 import com.xt.js.gkaq.common.BaseCtl;
+import com.xt.js.gkaq.common.Constants;
 import com.xt.js.gkaq.common.log.annotation.SysLog;
 import com.xt.js.gkaq.frame.model.ComboBoxDto;
 import com.xt.js.gkaq.frame.model.GroupButtonModel;
 import com.xt.js.gkaq.frame.model.GroupMenuModel;
 import com.xt.js.gkaq.frame.model.GroupModel;
 import com.xt.js.gkaq.frame.model.GroupModelDto;
+import com.xt.js.gkaq.frame.model.UserModel;
 import com.xt.js.gkaq.frame.service.GroupButtonService;
 import com.xt.js.gkaq.frame.service.GroupMenuService;
 import com.xt.js.gkaq.frame.service.GroupService;
@@ -184,7 +188,14 @@ public class GroupCtl extends BaseCtl {
     @ResponseBody
     public String getGroupList() {
 
-        List<ComboBoxDto> list = groupService.findByCombo();
+        String orgid = "";
+        // µ±Ç°Óû§ÏµÄ×éÖ¯
+        Subject subject = SecurityUtils.getSubject();
+        UserModel user = (UserModel) subject.getPrincipal();
+        if (!Constants.USER_TYPE_SA.equals(user.getRylx())) {
+            orgid = user.getOrgid();
+        }
+        List<ComboBoxDto> list = groupService.findByCombo(orgid);
         return JSONArray.toJSONString(list);
     }
 

+ 8 - 1
gkaqv2/trunk/modules/web/src/main/java/com/xt/js/gkaq/web/ctl/OrgCtl.java

@@ -208,7 +208,14 @@ public class OrgCtl extends BaseCtl {
     @ResponseBody
     public String getOrgList() {
 
-        List<ComboBoxDto> list = orgService.findByCombo();
+        String pid = "";
+        // µ±Ç°Óû§ÏµÄ×éÖ¯
+        Subject subject = SecurityUtils.getSubject();
+        UserModel user = (UserModel) subject.getPrincipal();
+        if (!Constants.USER_TYPE_SA.equals(user.getRylx())) {
+            pid = user.getOrgid();
+        }
+        List<ComboBoxDto> list = orgService.findByCombo(pid);
         return JSONArray.toJSONString(list);
     }
 

+ 33 - 1
gkaqv2/trunk/modules/web/src/main/java/com/xt/js/gkaq/web/ctl/UserCtl.java

@@ -4,7 +4,9 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import java.util.List;
 
+import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.crypto.hash.Sha256Hash;
+import org.apache.shiro.subject.Subject;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -71,6 +73,13 @@ public class UserCtl extends BaseCtl {
         }
         if (StringUtils.isNotEmpty(vo.getOrgid())) {
             model.setOrgid(vo.getOrgid());
+        } else {
+            // 当前用户下的组织
+            Subject subject = SecurityUtils.getSubject();
+            UserModel user = (UserModel) subject.getPrincipal();
+            if (!Constants.USER_TYPE_SA.equals(user.getRylx())) {
+                model.setOrgid(user.getOrgid());
+            }
         }
 		List<UserModel> list = userService.findAllByCond(model);
 		PageInfo<UserModel> pageResult = new PageInfo<>(list);
@@ -107,6 +116,16 @@ public class UserCtl extends BaseCtl {
             // 登录密码:123456
             String pwd = new Sha256Hash("123456").toHex();
             model.setLoginPassword(pwd);
+            // 是否经营人
+            if (Constants.CHK_YES.equals(vo.getIfAdmin())) {
+                model.setRylx(Constants.USER_TYPE_1);
+            } else {
+                model.setRylx(Constants.USER_TYPE_2);
+            }
+            // 所属船代
+            if (Constants.CHK_YES.equals(vo.getIfShip())) {
+                model.setRylx(Constants.USER_TYPE_3);
+            }
             userService.add(model);
             UserInfoModel userInfoModel = new UserInfoModel();
             BeanUtils.copyProperties(vo, userInfoModel);
@@ -130,7 +149,20 @@ public class UserCtl extends BaseCtl {
         } else {
             // 更新
             UserModel model = userService.findById(vo.getId());
-            BeanUtils.copyProperties(vo, model, new String[] { "loginPassword" });
+            BeanUtils.copyProperties(vo, model, new String[] { "loginPassword", "rylx" });
+            // 非管理员变更用户类型
+            if (!Constants.USER_TYPE_SA.equals(model.getRylx())) {
+                // 是否经营人
+                if (Constants.CHK_YES.equals(vo.getIfAdmin())) {
+                    model.setRylx(Constants.USER_TYPE_1);
+                } else {
+                    model.setRylx(Constants.USER_TYPE_2);
+                }
+                // 所属船代
+                if (Constants.CHK_YES.equals(vo.getIfShip())) {
+                    model.setRylx(Constants.USER_TYPE_3);
+                }
+            }
             userService.update(model);
             UserInfoModel userInfoModel = new UserInfoModel();
             BeanUtils.copyProperties(vo, userInfoModel);

+ 16 - 1
gkaqv2/trunk/modules/web/src/main/webapp/static/js/common/common.js

@@ -373,7 +373,12 @@ $.formatString = function (str) {
 
 if (typeof constData == "undefined") {
     var constData = {};
-    // 订单状态
+    // 人员类型
+    constData.userType_0 = "管理员";
+    constData.userType_1 = "行政人员";
+    constData.userType_2 = "经营人";
+    constData.userType_3 = "船代";
+    // 组织类型
     constData.orgType_0 = "省局";
     constData.orgType_1 = "所在地";
     constData.orgType_2 = "市局";
@@ -381,4 +386,14 @@ if (typeof constData == "undefined") {
     constData.orgType_4 = "站所";
     constData.orgType_8 = "企业";
     constData.orgType_9 = "科室";
+    
+//    $.ajax({
+//        type : "post",
+//        url : basePath + '/dict/findDicts?pcode=ORG_TYPE',
+//        success : function(data) {
+//            $.each(data, function() {
+//                eval('constData.orgType_' + data.optVal + '="' + data.optName + '"');
+//            });
+//        }
+//    });
 }

+ 12 - 1
gkaqv2/trunk/modules/web/src/main/webapp/static/js/user/index.js

@@ -136,7 +136,7 @@ function initGrid() {
         sortname : "", // 默认的排序列
         sortorder : "", // 默认的排序列
         colNames : [
-                'id', '用户名', '登录名', '性别', '联系电话'
+                'id', '用户名', '登录名', '人员类型', '性别', '联系电话'
         ],
         colModel : [
                 {
@@ -154,6 +154,17 @@ function initGrid() {
                     index : 'loginName',
                     sortable : false
                 }, {
+                    name : 'rylx',
+                    index : 'rylx',
+                    sortable : false,
+                    formatter : function(cellvalue, options, rowObject) {
+                        var val = eval('constData.userType_' + cellvalue);
+                        if (isNull(val)) {
+                            val = cellvalue;
+                        }
+                        return val;
+                    }
+                }, {
                     name : 'sex',
                     index : 'sex',
                     sortable : false